I have been learning java in school. Were only learning the extreme basics so please bear with me
Were using a file ( I think its called a library ) to grab user input an then display it on screen in our java programs.
I want to learn how to avoid using the program and have been looking up tutorials on YouTube.
I seen the scanner but its confusing as to how I would use it in a program such as this. Also is there a better option than scanner?
What I want to do is ask what age are you?
then age will equal the users input.
Joined: Nov 22, 2011
Ah I have since figured all of this out!
It took a while but I'm beginning to grasp the use of the Scanner!
Don't think that Scanner is confusing or hard understand.
Remember Java's 1st Feature is that Java is "Simple" so, nothing is hard in java.
Scanner is very easy.
I will explain you how to use it and why .......
Now, If you want to read user input age from the console.
following is the code snippet in java using scanner.
Satyen Singh wrote:. . . . Remember Java's 1st Feature is that Java is "Simple" so, nothing is hard in java. . . .
You have misunderstood the intention behind “simple”. It means that a programmer can remember all the rules, without having to look them up. I am not at all convinced they have achieved that intention, least of all since the introduction of generics in Java5.