Scanner class example program in java

Scanner class in Java

In java the  Scanner class is embedded in  java.util  API package 

A Scanner class  have next method which support  java primitive types . next method provide  the facility  to get  input from keyboard of any type of data and store in a primitive varible.

next method connected with Scanner class object.

Different type of next method are as under.

primitive type       next method

int                        nextInt()

long                     nextLong()

float                     nextFloat()

double                 nextDouble()

for String class     nextLine()

write a program in java display information  of a person like name,number,fees,salary etc using with scanner class in java.

output of program using with scanner class in java

Scanner class in Java
Scanner class in Java
(Visited 315 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

Reload Image