Java: Input using System.in and add numbers

 

 

Here is the AddNum.java source code

import java.util.Scanner;
public class AddNum {
  
  
  public static void main(String[] args) { 
     Scanner keyboard = new Scanner(System.in);
     
     System.out.print("Enter the first number");
     int number1 = keyboard.nextInt();  
     
     System.out.print("Enter the second number");
     int number2 = keyboard.nextInt(); 
     
     int result = number1 + number2;
     
     System.out.println("First number is "+number1);
     System.out.println("Second number is "+number2);
     System.out.println("The SUM is "+result);
     
  }  
}