Results 1 to 2 of 2
- 01-29-2013, 12:26 AM #1
Member
- Join Date
- Jan 2013
- Posts
- 3
- Rep Power
- 0
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:
Any help would be greatly appreciated.Java 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]); }Last edited by sims34; 01-29-2013 at 05:32 AM.
- 01-29-2013, 04:46 AM #2
Re: How to print array from user input?
Follow the link posted in this response in your last thread: Assign data enter by user to a 2D Array
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
How to store user input into an array
By codyjava in forum New To JavaReplies: 11Last Post: 12-02-2012, 04:08 AM -
Creating 2D array from all user input
By peek_a_boo in forum New To JavaReplies: 1Last Post: 12-08-2011, 08:16 PM -
Print Parts Of An Array [User Input]
By PrimalScientist in forum New To JavaReplies: 22Last Post: 08-30-2011, 11:09 AM -
user input array
By localhost in forum New To JavaReplies: 5Last Post: 12-30-2010, 04:00 AM -
How to ask the user how many elements to print from an array?
By rania.idan in forum New To JavaReplies: 2Last Post: 12-02-2010, 04:18 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks