On Aug 9, 11:03 pm, JKid314159 <[email protected]> wrote:
> Dear Java Programmer:
>  
>  
> I am not too sure I have followed the instructions:
>  
> I created the following:
> MyClassObject classObj1 = new MyClassObject("Eleven", 11);
You don't need this
but you need:

myhashset.add(new MyClassObject("Eleven", 11));

Then you need some getters and setters in MyClassObject and to
override the toString method of MyClassObject so that you can get a
user-friendly output when printing the HashSet.


>  
>  
> then
> System.out.println(hs.add(classObj1));
Use the hashset to display the value:
System.out.println(myHashSet);
>
>  
> Instructions say:
> "Display the HashSet object"
>  
> I receive result for two objects Obj1 and Obj2 added:
> myhashset.myclassobj...@addbf1,
> myhashset.myclassobj...@19821f
This is the hexadecimal form of the hash code value for this object.
See hashCode and toString method of class Object.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to