Java Program to Read Integer Value from the Standard Input

Write a Java program to read integer value from the standard input or console. To do this, we use the util packages Scanner class. First, import the same, and create an instance or object of the Scanner class and pass the parameter.

package RemainingSimplePrograms;

import java.util.Scanner;

public class ReadInteger1 {
	private static Scanner sc;
	public static void main(String[] args) {
		sc = new Scanner(;
		System.out.print("Enter Any Integer Value = ");
		int num = sc.nextInt();
		System.out.println("Given Integer Value = " + num);

Read Integer Value from the Standard Input

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.