Dead Thread.
But just for the sake of it:
Code:
import java.io.*;
public class UserInputFromOneLine{
public static void main(String[] args)**
//output a menu, message, whatever
System.out.println("Menu or whatever");
//Output a message which suggests multiple input necessary
System.out.print("Which choices would you like to select?: ");
//Create the BufferedReader object...
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//create a string to hold the user's input
String choices = null;
//get the user's input
try{
choices = br.readLine();
//catch errors(vague method)
} catch (IOException exc)**
System.out.println("Error: Something went wrong...");
}
//set up a string to hold the inputs as an array:
String[] choicesSplit = null;
choicesSplit = choices.split(" ");
//the array choicesSplit now contains the split choices... etc.
//output a message(or post-process, just whatever you need to do)
System.out.print("You chose: ");
//output the choices
for(String choice: choicesSplit)**
//output the choice
System.out.print(choice);
}
}
}
Cheers,
Jamey