examples of read data from user keyboard in java
All Contributions
java program to read first number and second number from user then prints the summation result
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("enter first number:");
int number1=input.nextInt();
System.out.println("enter second number:");
int number2=input.nextInt();
int result=number1+number2;
System.out.println(result);
}
}
total contributions (2)
simple calculater in java: