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
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)
Re: Use of UserInput.read () ?
Cheers Kevin for your help.
If its any help in solving the mystery there is also a UserInput.getInt()" ?
Re: Use of UserInput.read () ?
Quote:
Originally Posted by
native
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.
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.
Re: Use of UserInput.read () ?
Well turns out its a custom library :/
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.