|NO.Z.00038|——————————|BigDataEnd|——|Java&运算符.V05|——|Java.v05|运算符.v05|关系运算符|编程|
一、关系运算符概念使用
### --- 关系运算符概念
~~~ ——> > 表示是否大于运算符
~~~ ——> >= 表示是否大于等于运算符
~~~ ——> < 表示是否小于运算符
~~~ ——> <= 表示是否小于等于运算符
~~~ ——> == 是否等于运算符
~~~ ——> != 表示是否不等于运算符
~~~ ——> 所有以关系运算符作为最终运算的表达式结果一定是boolean类型。
二、编程代码
### --- 编程代码
/*
编程实现关系运算符的使用
*/
public class RelationTest {
public static void main(String[] args) {
// 1.声明两个int类型的变量并初始化
int ia = 5;
int ib = 2;
// 2.使用变量实现关系运算符的使用并打印结果
boolean b1 = ia > ib;
System.out.println("b1 = " + b1); // b1 = true
System.out.println(ia > ib); // 是否大于 true
System.out.println(ia >= ib); // 是否大于等于 大于或者等于 true
System.out.println(ia < ib); // 是否小于 false
System.out.println(ia <= ib); // 是否小于等于 false
System.out.println(ia == ib); // 是否等于 false
System.out.println(ia != ib); // 是否不等于 true
}
}
三、编译打印
### --- 编译
C:\Users\Administrator\Desktop\project>javac RelationTest.java
### --- 打印
C:\Users\Administrator\Desktop\project>java RelationTest
b1 = true
true
true
false
false
false
true
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
浙公网安备 33010602011771号