webisworld



Webisworld Edit Try It Editor
Share This Page :

temp image

Java Program to Get Input from User


Example:

import java.util.Scanner;

public class UserInput
{
	public static void main(String args[])
	{
		int num;
		Scanner scan = new Scanner(System.in);
		
		System.out.print("Enter a Number  ");
		num = scan.nextInt();
		
		System.out.print("You entered: " +num);
	}
}

Output:

Enter a Number: 10
You Entered: 10

Share This Page :

Was this page helpful?

Let us know how we did