当前位置: 代码迷 >> Eclipse >> 新手,返回的整形
  详细解决方案

新手,返回的整形

热度:87   发布时间:2016-04-23 01:25:16.0
新手求助,返回的整形?
代码是比较三个数大小,以从小到大输出
错误:在红色区域 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 了
  相关解决方案