bitwisedemo.java

来自「我自己学习JAVA过程中用键盘敲的代码」· Java 代码 · 共 43 行

JAVA
43
字号
package jerryhfb;

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.");

}

}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?