Rewrite the code below to correct the errors public findGrea
Rewrite the code below to correct the errors.
public findGreatest (int x, , integer z) {
if (x = z) {
System.in.println(\"x is equal to y\")
} else if x >= z
System.out.println(\"x is greater than or equal to z\")
} else
System.out.println(\"z is greater than x\")
return }
}
Solution
public class Greatest
{
public static void main (String[] args)
{
findGreatest(102,341); //call to function
}
public static void findGreatest (int x,int z)
{
if (x == z) {
System.out.println(\"x is equal to y\");
} else if (x >= z){
System.out.println(\"x is greater than or equal to z\");
} else
System.out.println(\"z is greater than x\");
}
}
output:
