Results 1 to 3 of 3
Thread: [HELP] A "collection" in Java
- 11-10-2011, 01:05 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 4
- Rep Power
- 0
[HELP] A "collection" in Java
Hello,
I don't know if I'm in the right section but here it goes.
So in Java you have arrays, which have a certain structure so you can return an object stored in that array at the index you like.
But now I'm doing this assignment where we make our own CollectionInterface which stores Indentifiers without any structure.
So now I can't just go: collection[4] = identifier.
Now I was wondering how I could store an input like this: {ball doll monkey} ; into a collection. And also how I could retrieve "doll"?
Yours,
liQuorice
- 11-10-2011, 02:30 PM #2
Re: [HELP] A "collection" in Java
Hi
You can use Object[]. when you want to get certain structure you can use typecasting or another way you have use generic for this aim. but I don't think that it will be good choice for you.Skype: petrarsentev
http://TrackStudio.com
- 11-11-2011, 01:46 AM #3
Re: [HELP] A "collection" in Java
Collections are already part of the standard Java library. You could look at the way it's done there.
Get in the habit of using standard Java naming conventions!
Similar Threads
-
Exception in thread "main" java.lang.NumberFormatException:input string: "060320
By renu in forum New To JavaReplies: 14Last Post: 04-08-2011, 06:01 PM -
Java, Military Format using "/" and "%" Operator!!
By sk8rsam77 in forum New To JavaReplies: 11Last Post: 02-26-2010, 03:03 AM -
Runtime error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
By shantimudigonda in forum New To JavaReplies: 1Last Post: 11-20-2009, 07:58 PM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks