CODE:
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(reader);
String input = in.readLine();
ArrayList<String> massiiv = new ArrayList();
for (int i = 0; i < input.length(); i++)
massiiv.add(input[i]); // error here
HI!
How can I split the input and add the input to the data structure massiiv?
For instance, input is: “Where do you live?”. Then the massiiv show be:
massiv[0] = where
massiv[1] = do
massiv[2] = you
THANKS!
The Java Documentation is your friend:
http://download.oracle.com/javase/6/docs/api/java/lang/String.html
String[] myWords = input.split(” “);