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
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: 161

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: 1202
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: 277

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: 1789

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.
subject: Need some help with my first assignment
It's not a secret anymore!