Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading from console and saving in an array 1

Status
Not open for further replies.

tig12

Programmer
Feb 27, 2007
20
GB
Hi,

I know how to write to the console i.e. system.out.println. But I don't know how to save their response.

When someone answers the question I want to save it in an array.

And then ask another question and save that in another one and so on.
-----------------------------------------
Here is my code:

double [] b = new double [3];

double [] c = new double [7];

Console console = System.console();

//asking questions



System.out.println("what is your name");
---------------------------------------------
(then I want to save this is b[0]).
----------------------------------------------

So I ask a question and this shows in the console and then they answer and I save the answer in b[0], then ask another question and save in b[1].

Thanks in advance




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top