1.关系运算符组成
关系运算符:> >> < << == !=
返回的结果值为:布尔值(true或者false)
使用情况:一般与逻辑运算表达式结合使用
2.代码演示:
public class Test02 {
@Test
public void TestA(){
int a =10;
int b =5;
boolean c = a>b; //1. a大于b 返回true 2. c=true
System.out.println("c = " + c); //返回结果:c = true
c = a ==b; // 1. a跟b是否相等 不相等返回false 2. c=false
System.out.println("c = " + c); //返回结果:c = false
int d = a+b;
boolean d1 = d<a-b; // 1. a-b=5 d=15 2. 15<5 false d1=false
System.out.println("d1 = " + d1); //返回结果:d1 = false
}
}