This code doesn't make sense for me
class MyClass{
MyClass obj = new MyClass();
public static void main(String[] args){
MyClass obj = new MyClass();
}
}
So the Question is how could class definition contain its own object creation?
for example like above code MyClass
instance variable obj
creates its own object. here I want to understand if it works then how does it actually works behind the scene, And also what is the benefit of doing it this way ..
detail explanation is needed .. thanks in advance