Hi there,
I am new to Java and have a question about user input.

In my book they use Keyboard.readInt() etc
A tutorial I watch does
Scanner input = new Scanner(system.in)
I also saw a few videos doing, well I don't remember exactly but something like...
I remember they imported io.* or somethig, and before the class body they wrote throws exception.
And they also had to use bufferedReader.

Is any of these ways the 'best' way?
Or perhaps one/some/all of these ways are outfated?
Or simply bad for some reason?

Whicj one should I use?

I'm watching tutorials with Scanner, so that is what I'm most comfortable with.

Alsi, I have seen some classes looking like
Class name extends b{}
What does that mean? That might be too advanced for me though as I am pretty new to Java.

Edited by Ezzaral: Merging text

5 Years
Discussion Span
Last Post by OblibSystems

The Scanner class is a very easy way to get user input. It has a lot of useful methods that can help you determine what will be read and to convert the input from String to different data types.
There are lots of different I/O classes for reading data. Each has a different use and purpose.

Do you have a link to the Java Tutorial? You should look through that for the answers to your basic java programming questions.

Edited by NormR1: n/a


You will need to try different ones to see what best fits your purpose.
You will probably find one you like better than others and stick to that one until you REALLY need something else.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.