java中 return后面语句可以不加大括号吗 程序中写了
.......publicintcompareTo(Objecto){Namea=(Name)o;intlastCmp=lastName.compareTo(a.last...
.......
public int compareTo(Object o){
Name a=(Name)o;
int lastCmp=lastName.compareTo(a.lastName);
return
{
(lastCmp!=0 ? lastCmp :
firstName.compareTo(a.firstName);
}
} 展开
public int compareTo(Object o){
Name a=(Name)o;
int lastCmp=lastName.compareTo(a.lastName);
return
{
(lastCmp!=0 ? lastCmp :
firstName.compareTo(a.firstName);
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询