- class X
- {
- static String ename;
- static void access(String cn)
- {
- ename=cn;
- System.out.println(ename);
- }
- }
- class Y
- {
- public static void main(String...x)
- {
- X.access("HCL");
- }
- }
- Output:
- HCL
- class Xx
- {
- String ename;
- void access(String cn)
- {
- ename=cn;
- System.out.println(ename);
- }
- }
- class Yy
- {
- public static void main(String...x)
- {
- Xx x1=new Xx();
- Xx x2=new Xx();
- x1.access("Aman");
- x2.ename="Kumar";
- System.out.println(x2.ename);
- }
- }
- Output:
- Aman
- Kumar
| Copyright ©2016 | All Rights Reserved |
| Design by Uves Khan |