Suppose I have class А and inner class А.В А , and I create an object of class А.В А in a method of another class (not А ).
A obj1 = new A(); AB obj2 = obj1.new B(); What is an obj2 object? Is it part of obj1 or an independent independent object?
I mean, the essence of a single object is something single, for example, an instance of Apple , which contains member data, a сорт and a member function to упастьСВетки() . What is the meaning of the inner class in the same way? Is it possible to give a similar example for inner classes?
obj2is a separate object in memory, but with access to fields and methods of the outer class. - Nofate ♦