Results 1 to 3 of 3
  1. #1
    Muxlcv is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default 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..

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,585
    Rep Power
    25

    Default 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.

  3. #3
    nielscorn is offline Member
    Join Date
    Jan 2012
    Posts
    3
    Rep Power
    0

    Default 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

  1. Stupid mistake, maybe?
    By knox in forum New To Java
    Replies: 1
    Last Post: 11-10-2011, 08:39 AM
  2. Stupid error
    By dewitrydan in forum Java Applets
    Replies: 3
    Last Post: 08-09-2010, 01:29 PM
  3. Singleton considered stupid, Java and complexity
    By fishtoprecords in forum Forum Lobby
    Replies: 11
    Last Post: 07-06-2008, 03:38 AM
  4. a really stupid question
    By SwinGirl in forum NetBeans
    Replies: 10
    Last Post: 06-25-2008, 09:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •