Find Largest Number in JAVA

This example of Java programming will teach you the coding for Finding the largest number amongst three In JAVA. Here we have taken three integers as x = 600, y = 400 and z = 800. After defining these three integers under the class “largernumber” apply “if” and “else” conditions that can help you in finding the largest value one by one.

Analyze every condition one by one and follow this example.

Here is the Solution of program:

class largernumber{

public static void main(String[] args) {

int x=600, y=400, z=800;

if (x>y){
if (x>z){
System.out.println(“x is greater”);
}
else{
if(z>y){
System.out.println(“z is greater”);
}
else{
System.out.println(“y is greater”);
}
}
}
else{
if (y>z){
System.out.println(“y is greater”);
}
}
}
}

Enjoy Coding.