I am confused with the following statement . Could anyone help me in understanding the following statement?
In java , a composite object cannot contain other objects. It can only have references to its constituent objects. Constituent Objects can be shared between objects and their lifetime can be independent of the lifetime of the composite object.
In other languages, such as C++, an Object can be thought of as containing another object. If an object of class A contains an object of class B, A will be bigger than B.
In Java you only have references from one class to another (a part from inheritance) If A references B, it doesn’t matter how big B is, it doesn’t influence the size of A.