This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Need some help with my first assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Need some help with my first assignment" Watch "Need some help with my first assignment" New topic

Need some help with my first assignment

Shon Shalit

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

Joined: Mar 15, 2001
Posts: 1194
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: 273

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()).

Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659

Shon --
There are links on the page with the assignment with tutorials. The one you're going to need is:

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.
Consider Paul's rocket mass heater.
subject: Need some help with my first assignment
Similar Threads
CTRL Mask on JButton
java native keyword and dll usage
java and c socket problem
well JAVA may also used? together(with Obj-C) or Java alone
What Level of Java Programmer Is GWT For?