How to print array from user input?
I'm working on this problem but I can't get the information that the user enters to print in the array, the only thing that prints is "done", I know if probably something simple but I can't figure it out. Here is what i have so far:
Code:
public static void main(String[] args) {
String[][] inputData = new String[10][2];
Scanner input = new Scanner(System.in);
String word = "";
while(true){
System.out.println("Enter your data: ");
word = input.next();
if(word.equalsIgnoreCase("done")){
System.out.println("Done, BYE!");
break;
}
}
System.out.println("This is the array");
for(int i = 0; i < inputData.length; i++){
for(int j = 0; j < inputData[i].length; j++){
inputData[i][j] = word
System.out.print(inputData[i][j]);
}
Any help would be greatly appreciated.
Re: How to print array from user input?
Follow the link posted in this response in your last thread: http://www.java-forums.org/new-java/...tml#post317217
db