高等继续教育 / Java程序设计
正确率:认证
题型描述: 编程题
读下面程序,给出最后屏幕输出结果。
public class BitwiseDemo {
static final int VISIBLE = 1; static final int DRAGGABLE = 2;
static final int SELECTABLE = 4; static final int EDITABLE = 8;
public static void main(String[] args) {
int flags = 0;
flags = flags | VISIBLE;
flags = flags | DRAGGABLE;
if ((flags & VISIBLE) == VISIBLE) {
if ((flags & DRAGGABLE) == DRAGGABLE) {
System.out.println("Flags are Visible and Draggable.");
}
}
flags = flags | EDITABLE;
if ((flags & EDITABLE) == EDITABLE) {
System.out.println("Flags are now also Editable.");
}
}
}
参考答案:
佳题速递: