class ClassA
{
public void methodA()
{
ClassB classB = new ClassB();
classB.getValue();
//System.out.println(" ClassA's methodA()!");
}
}
class ClassB
{
public Test classC=new Test();
public
String getValue()
{
//System.out.println("ClassB's getValue() !");
return classC.getValue();
}
}
public class Test
{
public String value="ss";
public String getValue()
{
value = "ClassB";
// System.out.println("Test's getValue()!");
return value;
}
public static void main(String s[])
{
ClassA a = new ClassA();
a.methodA();
// System.out.println("main mothods()!");
}
}
Look at "public Test classC=new Test(); ",if I write this, there is no errors! Compilation successfully! So I think, the object classC must be instantiate. This is my own standpoint!