0
Do anybody can help me?
class maxmethod{ static int Sum(int x, int y){ if(x>=y){ if(x==y){ System.out.println("This two numbers is equal"); } else{ return x; } } else{ return y; } } public static void main (String [] args){ int max = Sum(56,79); System.out.println(max); } } I don't know why it can not run? could everyone help me to figure out this? Thank you.
2 Respostas
+ 1
You have to return a value after the below line
System.out.println("This two numbers is equal");
such as return 0;
0
Add "return 0" before ending of Sum method.
like this:
//your code
//your code
return y; }
return 0; }
public static void main (String [] args){