新手求助,返回的整形?
代码是比较三个数大小,以从小到大输出
错误:在红色区域 This method must return a result of type int
为什么啊?我定义的是int啊,求解
public class MyPoint{
public static int daXiao(int a,int b,int c)
{
if(a>b)
{
if(a>c)
{
if(b>c)
System.out.println(c+" "+b+" "+a);
else
System.out.println(b+" "+c+" "+a);
}
else
System.out.println(b+" "+a+" "+c);
}
else
{
if(a>c)
{
System.out.println(c+" "+a+" "+b);
}
else
if(b>c)
System.out.println(a+" "+c+" "+b);
else
System.out.println(a+" "+b+" "+c);
}
}
public static void main(String [] args)
{
daXiao(7,5,0);
}
}
[解决办法]
.daXiao()方法里面你忘记return 了