📄 shortcircuit.java
字号:
/*
*短路现象测试
*/
public class ShortCircuit
{
public static void main(String[] args)
{
ShortCircuit a = new ShortCircuit();
if( a.test1(0) && a.test2(2) && a.test3(2))
{
System.out.println("the statement is true!");
} else
{
System.out.println("the statement is false!");
}
}
public boolean test1(int value1)
{
System.out.println("test1 (" + value1 + ")");
System.out.println("result: " + (value1 < 1));
return value1 < 1;
}
public boolean test2(int value2)
{
System.out.println("test2 (" + value2 + ")");
System.out.println("result: " + (value2 < 2));
return value2 < 2;
}
public boolean test3(int value3)
{
System.out.println("test3 (" + value3 + ")");
System.out.println("result: " + (value3 < 3));
return value3 < 3;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -