/*class A*/ public class A { public Object obj; public A(B b) { obj = b; } } /*class B*/ public class B { int example = 1; public int getValue() { return example; } } /*main*/ public class Example { public static void main(String args[]) { A a = new A(new B()); a.obj.getValue(); } } /*compiler: * javac Example.java * Example.java:4: cannot find symbol * symbol : method getValue() * location: class java.lang.Object * a.obj.getValue(); * ^ * 1 error */