How To Get User Input Using Scanner In Java | How To Get User Input Using System.in.read() In Java

Описание к видео How To Get User Input Using Scanner In Java | How To Get User Input Using System.in.read() In Java

Video Link:
------------------
Type Casting in Java|Explicit and Implicit Type Conversion|Implicit Typecasting|Explicit Typecasting

   • Type Casting in Java|Explicit and Imp...  

follow me on:
Facebook:   / pawans.nair.7  
Instagram:   / pawan_s_nair  
Twitter:   / pawannair  
Linked in:   / pawan-nair-669860168  

In this video, we will be discussing how to get user input in java using Scanner Class and we will also see the alternative was of using Scanner class is System.in.read()

Scanner Class:
-------------------------
Scanner Class is a predefined class present in java which is having some predefined method using which you can get the user input.

Some of the methods are mentioned below:
1)nextInt();
2)nextLong();
3)nextFloat();
4)nextDouble();
5)nextLine();
6)nextChar();
and many more.

where nextLine(); is used for capturing the string value.

System.in.read();
-----------------------------
In the case of System.in.read() we can find that it basically read one character at a time and even it get the ASCII value of it.

Because of that, we need to do typecasting into char. to see the actual result.

And if you want to read more than one character then looping will the best option to read and print the value.

Комментарии

Информация по комментариям в разработке