Question: Start with a hello world program in Eclipse. Add code to ask the user for three numbers, and then display the number that is the

Start with a hello world program in Eclipse.

Add code to ask the user for three numbers, and then display the number that is the largest.

I want to make sure the code is correct

my code:

package test3; import java.util.Scanner;

public class TestStart {

public static void main(String{[]args) { System.out.println("Hello World"); public class Largest {

public static void main(String[] args) {

double n1 = -4.5, n2 = 3.9, n3 = 2.5;

if( n1 >= n2 && n1 >= n3) System.out.println(n1 + " is the largest number.");

else if (n2 >= n1 && n2 >= n3) System.out.println(n2 + " is the largest number.");

else System.out.println(n3 + " is the largest number."); } } } }

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!