| Author |
Need some help with my first assignment
|
Shon Shalit
Greenhorn
Joined: Jul 16, 2010
Posts: 1
|
|
Hey, i'm a complete java newbie, i took a C++ class a year ago, and i did pretty well, so i know my way around loops. i already made a for loop that will run 100 times, the only problem now is i don't know the code that would allow the user to input something for the app to print.(i think in C++ it was called cin)
thanks in advance
|
 |
Gary Ba
Ranch Hand
Joined: Oct 23, 2009
Posts: 150
|
|
Try using the String parameter from your main() and see if that works.
Or maybe use BufferedReader?
|
star chaser..
|
 |
Carol Murphy
village idiot
Bartender
Joined: Mar 15, 2001
Posts: 1172
|
|
From the command prompt if you are in your development directory just type:
java nameofapp argument
The string you have provided as the argument is passed into main and if your code runs as anticipated, all should be well
|
 |
Michael Angstadt
Ranch Hand
Joined: Jun 17, 2009
Posts: 272
|
|
|
You can get command-line parameters using the "args" array (sort of like in C++). To get user input while the program is running you can use the Console class (call System.console()).
|
SCJP 6 || SCWCD 5
|
 |
Janeice DelVecchio
Saloon Keeper
Joined: Sep 14, 2009
Posts: 1612
|
|
Shon --
There are links on the page with the assignment with tutorials. The one you're going to need is: http://www.javaranch.com/drive/command.html
Most assignments have some hints included in them or as links. Keep your eye out!
|
When you do things right, people won't be sure you've done anything at all.
|
 |
 |
|
|
subject: Need some help with my first assignment
|
|
|