I am having a problem with arrays.... for this assignment i can not use Arraylist... I only be able to use array of string.
here is my problem. I am asking the user to enter words with in 1 minute ... when the time is up ..i need to print out what ever the user entered...
1, I am going to set up BufferedReader to accept input
2, then will try to split using split method
3, THIS IS THE PROBLEM I HAVE... I DON'T KNOW HOW STORE IT IN ARRAY.
can I creat by saying String [] arrayList = new String [200]
I am just assuming the user wont put more than 200 words in 1 min... How can i be able to store all the input ? how can i be able to print out in order that has been entered? Just need littile help storing the list in array...thank you.
mikias.kidane.9
0
Newbie Poster
Recommended Answers
Jump to PostWell, if you're using the String.split() method, it handles creating the array for you. Maybe explain how you are splitting things up, like do you have to handle each line individually? Or is it all going to be one line? Etc.
If you have to handle the split yourself, then …
Jump to Post6) and 7) make sense. You could use String[1000] also. The extra unused slots in the array take up very little room.
You will need an int value as an index that points to the next empty slot in the array. As you add Strings to the array, increment the …
All 6 Replies
nmaillet
97
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
mikias.kidane.9
0
Newbie Poster
mikias.kidane.9
0
Newbie Poster
Starstreak
13
Light Poster
NormR1
563
Posting Sage
Team Colleague
Starstreak
commented:
Oh, boy! You telling that tyo a beginner without explaininghow it works. tsk tsk!
+0
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.