Results 1 to 3 of 3
- 01-10-2012, 11:22 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 1
- Rep Power
- 0
Quite new to java, few stupid questions..
A couple of things that I haven't really understood....
For example..:
Scanner scan = new Scanner(System.in); - - What does this actually do?, something with a new scanner ;/?
Cost = scan.nextInt(); -- somethinge related to the above one?
Price = scan.nextInt(); -- These seem to repeat themselves after every "System.out.print" why?
Btw, I'm currently trying to figure out how a simple text program works and these are the things that I'm clueless of..
- 01-10-2012, 11:26 PM #2
Re: Quite new to java, few stupid questions..
The Scanner class is for reading input. You can select the source of the input in the Scanner class's constructor.
The in variable in the System class is a reference to a class that is connected to the console/keyboard allowing a user to type data into your program.
Read the API doc for the Scanner class to see what its methods do. Go to this site, look in the lower left window for Scanner and click on it to get the API doc for the Scanner class in the main window.
Java Platform SE 6
The out variable of the System class is an output class that has a print() method that will print on the console.
- 01-11-2012, 12:25 PM #3
Member
- Join Date
- Jan 2012
- Posts
- 3
- Rep Power
- 0
Re: Quite new to java, few stupid questions..
Something you will find VERY usefull is probably thisList of Videos for Java
It has tons of tutorial videos for beginning coders! The things you ask get explained VERY well!
Similar Threads
-
Stupid mistake, maybe?
By knox in forum New To JavaReplies: 1Last Post: 11-10-2011, 08:39 AM -
Stupid error
By dewitrydan in forum Java AppletsReplies: 3Last Post: 08-09-2010, 01:29 PM -
Singleton considered stupid, Java and complexity
By fishtoprecords in forum Forum LobbyReplies: 11Last Post: 07-06-2008, 03:38 AM -
a really stupid question
By SwinGirl in forum NetBeansReplies: 10Last Post: 06-25-2008, 09:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks