1.8K
Program to print a number, after taking number as a input.
// Java program to take an integer
// as input and print it
import java.io.*;
import java.util.Scanner;
// Driver Class
class GFG {
// main function
public static void main(String[] args)
{
// Declare the variables
int num;
// Input the integer
System.out.println("Enter the integer: ");
// Create Scanner object
Scanner s = new Scanner(System.in);
// Read the next integer from the screen
num = s.nextInt();
// Display the integer
System.out.println("Entered integer is: "
+ num);
}
}
What You get as Output , After running the program
Enter the integer: 10
Entered integer is: 10