The java program given below will ask to provide a number, that will be stored into a variable and later the stored data will be displayed. This program will process the integer type data as I have used the line a = in.nextInt();
Java program to get an integer number as input from keyboard and to display that
import java.util.Scanner;
public class InputOutput{
public static void main(String [] args){
int a;
System.out.println("Provide an integer value for a:");
Scanner in = new Scanner(System.in);
a = in.nextInt();
System.out.println("Stored int value in a ="+a);
}
}
No comments:
Post a Comment