Association

  1. class X
  2. {
  3. static String ename;
  4. static void access(String cn)
  5. {
  6. ename=cn;
  7. System.out.println(ename);
  8. }
  9. }
  10. class Y
  11. {
  12. public static void main(String...x)
  13. {
  14. X.access("HCL");
  15. }
  16. }
  17. Output:
  18. HCL
  1. class Xx
  2. {
  3. String ename;
  4. void access(String cn)
  5. {
  6. ename=cn;
  7. System.out.println(ename);
  8. }
  9. }
  10. class Yy
  11. {
  12. public static void main(String...x)
  13. {
  14. Xx x1=new Xx();
  15. Xx x2=new Xx();
  16. x1.access("Aman");
  17. x2.ename="Kumar";
  18. System.out.println(x2.ename);
  19. }
  20. }
  21. Output:
  22. Aman
  23. Kumar

| Copyright ©2016 | All Rights Reserved |
| Design by Uves Khan |

Free Web Hosting