permaculture playing cards*
The moose likes Java in General and the fly likes How to call nested classes inside constructor? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to call nested classes inside constructor?" Watch "How to call nested classes inside constructor?" New topic
Author

How to call nested classes inside constructor?

Michael Lars
Greenhorn

Joined: May 12, 2012
Posts: 20

Hello!

Maybe I don't have formulated the question correctly, but what i want to do is:

Product p = new C1(C2(C3(obj)));

where (classes) C1,C2,C3 are not ordered (can be random or repetitive)!

How can i do this on run-time?

Thank you!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3429
    
  12
The new only applies to your C1 object. If you want to create the other objects as well you need something like this


Joanne
Michael Lars
Greenhorn

Joined: May 12, 2012
Posts: 20

Thank you!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to call nested classes inside constructor?
 
Similar Threads
how many objects will be eligible for garbage collection
Is this explanation correct?
Garbage Collection
composit component in UML 2.0
merging two lists inside a list