how can I create an instance with a reference to an object that was created at the beginning of the program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how can I create an instance with a reference to an object that was created at the beginning of the program?

Class A { Class B { // how to reference Object A? } public static void main() { A a = new A(); a.method(); } }

8th Dec 2020, 11:26 AM
cny
cny - avatar
1 Answer
+ 2
public class A { public static int i = 30; public class B { int j = 4; public class C { int k = i; } } } Objects: A a = new A(); A.B b = a.new B(); A.B.C c = b.new C();
8th Dec 2020, 11:57 AM
JaScript
JaScript - avatar