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