if (number1 + 8 == number2 || number1 - 8 == number2){
if (name1.equals(name2)){
if (cod1 == cod2){
if (some1.equals(some2)){
System.out.println("They're in the same group");
}
System.out.println("They are in the same column");;
}
System.out.println("They are in the same section");
}
System.out.println("They are in the same subgroup");
}
else{
System.out.println("They are different");
}
}
}
我怎么能改变这个,让我只在最后得到一个消息?现在它提供了所有的信息,或只是它们不同。我知道我不能把一个实际的休息,因为这不是一个循环,但我可以采取什么行动在这个问题?我需要重写吗?感谢您的帮助。如何在java上使用if语句结束一个结果?
尽可能使用'else' .. – karthikr