Results 1 to 3 of 3
Thread: Pass User Input into an Array
- 05-14-2012, 04:15 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Pass User Input into an Array
I am asking for user input and I want to pass that UserInput into an array. The code I am using is:
I get numerous compile errors:Java Code:enteredHoursWorked = JOptionPane.showInputDialog("Enter hours worked"); myArray[] = enteredHoursWorked;
error not a statement
error ";" expected
How would I pass user input into an array?
- 05-14-2012, 05:24 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Re: Pass User Input into an Array
See the API for JOptionPane - the method you are using returns a String. We have not idea what you are trying to do, what type of array you have created, if you want the String to be part of the array or you wish to parse the String, but based upon what you posted you cannot assign an array to a String.
- 05-14-2012, 05:45 PM #3
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Similar Threads
-
Trouble! - Converting an User Input value to Array.
By derekdelgrosso in forum New To JavaReplies: 1Last Post: 02-07-2012, 04:58 PM -
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 -
how to pass user input into multi-dimensional arrays
By ziongio in forum New To JavaReplies: 4Last Post: 03-09-2011, 05:54 AM -
user input array
By localhost in forum New To JavaReplies: 5Last Post: 12-30-2010, 04:00 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks