I am wondering about this below code,
public class Abc {
private Abc p;
}
When the class is compiled how does the compiler know of the type ABC
, since the type ABC
hasn't came to existence yet.
I studied python and I learned how a python class gets constructed,
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
In the above python code, the name Person
gets assigned to the corresponding class object, after all variable and method definitions inside that class.
I would like to know about how a java class gets constructed under the hood and how it can contain a reference type of its own type.
Can someone provide me a deep explanation on that or give me a good reference book for those topics regrading to what happens under the hood?