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.

10th Sep 2016, 10:35 PM
Donnie Z
Donnie Z - avatar
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;
11th Sep 2016, 4:17 PM
Tiger
Tiger - avatar
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){
12th Feb 2017, 11:25 AM
Matiullah Karimi
Matiullah Karimi - avatar