New to java and a concept is confusing me a lot.
As a c++ programmer when we declare a class we can not have a property having an object of same class like lets say we have a class name Foo as belows
class Foo {
int age;
Foo someName;
}
the above code will give error. While in java i can do it. Is there a special reason behind it? And how does it happen. Any good read will be helpful.