Question: Type the below source inside task1.java. and run the program that reads two integers, calculates the sum of the numbers and displays the output Notes:

Type the below source inside task1.java. and run the program that reads two integers, calculates the sum of the numbers and displays the output

Notes: Dont forget to input the two data in advance inside the input console.

import java.util.Scanner;

public class FirstProgram {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

System.out.println ("Hello out there.");

System.out.println ("I will add two numbers for you.");

System.out.println ("Enter two whole numbers on a line:");

double n1, n2;

Scanner keyboard = new Scanner (System.in);

n1 = keyboard.nextInt ();

n2 = keyboard.nextInt ();

System.out.println ("The sum of those two numbers is");

System.out.println (n1 + n2);

}

}

Here is a sample run that will show in the Output Window below Source editing window.

Outputs

Hello out there.

I will add two numbers for you.

Enter two whole numbers on a line:

The sum of those two numbers is

4.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!