Results 1 to 4 of 4
Thread: Collection class
- 12-14-2012, 06:20 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 7
- Rep Power
- 0
- 12-14-2012, 06:27 AM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
Re: Collection class
In this forum we are not providing a help to write code. But, we are happily help to guide you if you have any problems with your code. So, please write the code and tell us where you got stuck with it.
Website: Learn Java by Examples
- 12-14-2012, 06:48 AM #3
Member
- Join Date
- Dec 2012
- Posts
- 7
- Rep Power
- 0
Re: Collection class
import java.util.*;
Im a newbie to Java, So im learning able these concepts. Im struck at how to list which months have 30days and which have 31days and which have 28days and also how to print that has only 30days
Im happy to learn but I dont have proper resources to learn, so seeking help
public class CollectionTest {
public static void main(String [] args) {
System.out.println( "Collection Example!\n" );
int size;
HashSet collection = new HashSet ();
String str1 = "Jan", str2 = "Feb", str3 =
"Mar", str4 = "Apr", String str5 = "May", str6 = "June", str7 =
"July", str8 = "Aug",String str9 = "Sep", str10 = "Oct", str11 =
"Nov", str12 = "Dec";
Iterator iterator;
collection.add(str1);
collection.add(str2);
collection.add(str3);
collection.add(str4);
collection.add(str5);
collection.add(str6);
collection.add(str7);
collection.add(str8);
collection.add(str9);
collection.add(str10);
collection.add(str11);
collection.add(str12);
System.out.print("Collection data: ");
iterator = collection.iterator();
while (iterator.hasNext()){
System.out.print(iterator.next() + " ");
}
System.out.println();
}
- 12-14-2012, 07:01 AM #4
Member
- Join Date
- Dec 2012
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
how do we know which collection class to use when?
By Adithi in forum New To JavaReplies: 7Last Post: 09-07-2011, 07:24 AM -
Collections, Collection From one class to another
By D.Calladine in forum New To JavaReplies: 2Last Post: 11-23-2010, 02:10 PM -
Collections, Collection From one class to another
By D.Calladine in forum New To JavaReplies: 2Last Post: 11-16-2010, 03:39 PM -
collection class in java
By katturv in forum New To JavaReplies: 5Last Post: 10-24-2010, 07:09 PM -
know the class coming under the collection api in java
By javastuden in forum New To JavaReplies: 1Last Post: 11-24-2009, 07:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks