多选题 Given:
public class Dinner {
public static void main (String[] args)
{
boolean isKeeperFish = false;
if (isKeeperFish = true) {
System.out.println("Fish for dinner");
} else {
System.out.println("Take out for dinner");
}
}
}
What will be the result of the application's execution?
  • A. Fish for dinner will be printed.
  • B. Take out for dinner will be printed.
  • C. A compilation error will occur.
【正确答案】 A
【答案解析】由于只有一个等号(即赋值语句)用于if语句中,isKeeperFish变量被赋值为true。B和C不正确。