Computer Science, asked by LISHAN2820, 9 months ago

Write a java program to override method greatest () for finding the greatest of 2 numbers and 3 numbers

Answers

Answered by KHYATIJADWANI
0

Explanation:

public class JavaExample{

public static void main(String[] args) {

int num1 = 10, num2 = 20, num3 = 7;

if( num1 >= num2 && num1 >= num3)

System.out.println(num1+" is the largest Number");

else if (num2 >= num1 && num2 >= num3)

System.out.println(num2+" is the largest Number");

else

System.out.println(num3+" is the largest Number");

}

}

Similar questions