So I am creating a program that need to create as many strings and integers as the user says. The amount is stored in wordlength
, and I need to create these strings programmatically based on the input. Can somebody help me?
Asked
Active
Viewed 84 times
-4
![](../../users/profiles/4080982.webp)
Ian Sokullu
- 1
- 1
-
1Have you made an attempt at writing some code? – christopher Oct 23 '14 at 20:20
-
@christopher yes I have – Ian Sokullu Oct 23 '14 at 20:21
-
It sounds like you are trying to read in values from the console, which there are tons of answers about already. [Example](http://stackoverflow.com/questions/10854928/reading-a-string-with-new-lines-from-console-java) – DoubleDouble Oct 23 '14 at 20:22
-
as a start you can start by sketcing out a sample input and output – Sikorski Oct 23 '14 at 20:23
-
@IanSokullu - Christopher's comment was a hint that if you have code and need help with it, you should post it in your question. – Andrew Arnold Oct 23 '14 at 20:28
1 Answers
1
First, ask the user to input how many strings to store. This can be done through a Scanner
.
Then, make an array of type String with length
equal to the user input number.
Then, fill in the array through a Scanner with a for
loop.
I hope next time you search about you problem before you write a question about it.
![](../../users/profiles/3102832.webp)
mosemos
- 61
- 3