Everyone,

When the instructions say to add 2 objects from MyOwnClass, am I loading 
them individually like this ,


   MyOwnClass moc1 = new  MyOwnClass("Jeff", 55);     // MyOwnClass (String 
name, Int age); 
    
    hs.add(moc1.name); 
    hs.add(moc1.age);


or am I adding an object that is the whole class , such as 

    MyOwnClass moc1 = new  MyOwnClass("Jeff", 55);     
    MyOwnClass moc2 = new  MyOwnClass("Tom", 48); 
    hs.add(moc1); 
    hs.add(moc2);  


If I am supposed to do the second option, i.e., add the instance of the 
whole class as a collections item, then how do
I correctly interatre through that hash set (or other collection)  ?  Do 
I a conversion to a string when I print this ? 

What are the recommendations for this situation ?

Thank You and Regards,

Jeff 
 

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.

Reply via email to