Print an Integer – entered by user from console/command line

package JavaQuestions;

import java.util.Scanner;

 * @author NaveenKhunteta
public class PRintImnteger {

	public static void main(String[] args) {

		Scanner reader = new Scanner(;
		System.out.println("plz enter a number: ");

		int num = reader.nextInt();

		System.out.println("you entered: " + num);



Scanner class is a default class which is coming from java.util package. It is used to take the user input from the console.


plz enter a number: 


you entered: 10

Please follow and like us: