73 How to Communicating with Different Locations Packages in a Single Program in Java?



A Code:

package ram;

public class A
{
public static int a = 111;
}


B Code:

package sam;

public class B
{
public static void m1()
{
System.out.println("\n B class m1() ");
}
}


C Code:


package varun;

import ram.A;
import sam.B;

public class C
{
public static int a = 111;

public static void main( String args[] )
{
System.out.println("C class Main Method ");
System.out.println(A.a);
B.m1();
}
}

Output:


Previous
Next Post »