javaprogrammingwithpassion@googlegroups.com
[Top] [All Lists]

[java programming] LAB-1016 Java Collections Framework

Subject: [java programming] LAB-1016 Java Collections Framework
From: Recca
Date: Sun, 5 Jun 2011 17:49:31 -0700 PDT
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

<Prev in Thread] Current Thread [Next in Thread>
  • [java programming] LAB-1016 Java Collections Framework, Recca <=