On Homework exercise for Java Collections Framework. The instruction
says to "... Add the following objects with properly initialized
values to the newly created HashSet object ... 2 String objects ... 3
Integer objects ... "

My questions is do I have to declare the String and Integer this way:

hs.add(new String("string1"));
hs.add(new Integer(7));

or can I just do it this way:
hs.add("string1");
hs.add(7);

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to