This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

plz help me in this class question

 
jandost khoso
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to make an array that stores objects which have some differnt properties, whereas each object is itself an array which is formed from different objects that have properties.
how can i do that.
also i want to make a method that if i print one object of first array all objects and sub objecs be printed.
 
Raj Kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the size of the array is known beforehand, u can just create a 2 dimension array of Objects.
Object[][] obj = new Object[i][j];
Else u can use Vector, and store a Vector in each of its elements.
-----------------------------
also i want to make a method that if i print one object of first array all objects and sub objecs be printed.
-----------------------------
For this just make the method loop thru all the elements and call print on each element.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic