Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Use of UserInput.read () ?

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Use of UserInput.read () ?

    Hi all,

    Teaching myself Java for an exam coming up next month and in the notes I'm using they have "UserInput.readInt()" as well as "UserInput.readFloat()" - Now in the notes all that's there is a comment which reads /*read user input*/ but that is all. The code is just a small sample from a larger peice of code which is never referenced and i can't find any info online relating to this command. I was wondering if anyone knows this (?)function(?), how it works and its usage?

    Any help would be greatly appreciated!

    Native

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Use of UserInput.read () ?

    UserInput is not a class in the standard API, so it might be a class they wrote.

    Or it's a poorly named Scanner, in which case check out the API.

    Scanner (Java Platform SE 6)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Use of UserInput.read () ?

    Cheers Kevin for your help.
    If its any help in solving the mystery there is also a UserInput.getInt()" ?

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Use of UserInput.read () ?

    Quote Originally Posted by native View Post
    Cheers Kevin for your help.
    If its any help in solving the mystery there is also a UserInput.getInt()" ?
    Well, you tell me- is that a method in the Scanner class? Are you sure you're reading it right?

    Also, maybe you aren't supposed to care what UserInput is. Maybe that's the point- it could be a GUI, a Scanner, a file, or something else.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Use of UserInput.read () ?

    Well it does cover scanners and buffers later in these notes. I think maybe its just a terribly named scanner like you suggested. I kinda hoped it wasn't though
    I wish he'd put more of the program its sampled from in or explained it better.

  6. #6
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Use of UserInput.read () ?

    Well turns out its a custom library :/

  7. #7
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Use of UserInput.read () ?

    It doesn't really matter, does it? As long as you know the method signature and return value...?

    That's the way API's work - if you call method X on class Y, you get result Z.

Similar Threads

  1. [SOLVED] Read double from console without having to read a string and converting it to double.
    By Lord Voldemort in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: June 26th, 2011, 08:08 AM
  2. Trying to read a CSV file !
    By Cruz182 in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: June 2nd, 2011, 01:30 PM
  3. [SOLVED] How to read from GUI input?
    By KingOfClubs in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: April 21st, 2011, 01:32 PM
  4. CPU throttling at 100% during I/O read
    By v2102ap in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: January 21st, 2010, 05:30 AM