Java Absolute Beginner to Pro Tutorial - 14 - Scanner Class (Taking User Input)

Published: 03 March 2021
on channel: ᖇᗩ乙0229
63
3

We talk about taking user input in Java and type conversions in this video.
Scanner class in Java is found in the java.util package. Java provides various ways to read input from the keyboard, the java.util.Scanner class is one of them.
The Java Scanner class breaks the input into tokens using a delimiter which is whitespace by default. It provides many methods to read and parse various primitive values.
The Java Scanner class is widely used to parse text for strings and primitive types using a regular expression. It is the simplest way to get input in Java. By the help of Scanner in Java, we can get input from the user in primitive types such as int, long, double, byte, float, short, etc.
The Java Scanner class extends Object class and implements Iterator and Closeable interfaces.
The Java Scanner class provides nextXXX() methods to return the type of value such as nextInt(), nextByte(), nextShort(), next(), nextLine(), nextDouble(), nextFloat(), nextBoolean(), etc. To get a single character from the scanner, you can call next().charAt(0) method which returns a single character.
---------------------------------------------------------------------------------------------------------------------------
Instagram »   / raz0229​  
Facebook »   / raz0229​  
Twitter »   / raz0229​  
Github » https://github.com/raz0229​
Email » raja.zafar229@gmail.com


On this page of the site you can watch the video online Java Absolute Beginner to Pro Tutorial - 14 - Scanner Class (Taking User Input) with a duration of hours minute second in good quality, which was uploaded by the user ᖇᗩ乙0229 03 March 2021, share the link with friends and acquaintances, this video has already been watched 63 times on youtube and it was liked by 3 viewers. Enjoy your viewing!