Thursday , July 9 2020

Java Scanner

Use of Java Scanner API:

import java.util.Scanner;

public class JavaScanner
public static void main(String[ ] args)
// create a object of java scanner class
Scanner sc = new Scanner(;
// get the integer input from a user and store it in variable num
int num = sc.nextInt( );
// display the entered number by the user
System.out.print(“You typed: ” + num);
} // end-main

} // end-class JavaScanner

Check Also

Maximum and Minimum from an array, How to find ?

How to find maximum and minimum from an array? Problem Statement: Consider a one-dimension integer …

%d bloggers like this: