method problem
Hi!
I can't spot the compiler error for this code and i'm also not convinced that the method called below is going to work.
i want the output to be:
"The numbers that are below 100 are 69, 67, 2."
Can anyone help?thanks
class ReturnMaxNumber
{
publicstaticvoid main(String[] args)
{
int num1 = 69, num2 = 67, num3 = 488, num4 = 2;
System.out.println("The first number is " +num1);
System.out.println("The second number is " +num2);
System.out.println("The third number is " +num3);
System.out.println("The fourth number is " +num4);
System.out.println("");
System.out.println("The largest number is " +max(num1, num2, num3, num4));
System.out.println("The smallest number is " +min(num1, num2, num3, num4));
System.out.println("The numbers that are below 100 are " +below(num1, num2, num3, num4));
}
publicstaticint max(int x1,int x2,int x3,int x4)
{
int m = x1;
if (x2 > m) m = x2;
if (x3 > m) m = x3;
if (x4 > m) m = x4;
return m;
}
publicstaticint min(int x1,int x2,int x3,int x4)
{
int m = x1;
if (x2 < m) m = x2;
if (x3 < m) m = x3;
if (x4 < m) m = x4;
return m;
}
publicstaticint below(int x1,int x2,int x3,int x4)
{
if (x1 < 10)return x1;
if (x2 < 10)return x2;
if (x3 < 10)return x3;
if (x4 < 10)return x4;
}
}
ReturnMaxNumber.java:44: missing return statement
{
^
1 error

