官术网_书友最值得收藏!

4.2 Relational Operators

The relational operator determine the relationship that one operand has to the other. Specifically, they determine equality and ordering. Table 4.2 shows relational operators.

Table 4.2 Relational Operators

The outcome of these operations is a boolean value. The relational operators are most frequently used in the expressions that control the if statement and the various loop statements.

Any type in Java, including integers, floating-point numbers, characters, and Boolean can be compared using the equality test, = =, and the inequality test, !=. Notice that in Java equality is denoted with two equal signs, not one. ( single equal sign is the assignment operator.)

eg:

   int a = 4;
   int b = 1;
   boolean c = a < b;

In this case, the result of a < b (which is false) is stored in c.

主站蜘蛛池模板: 赞皇县| 神池县| 张家界市| 南阳市| 梓潼县| 宜宾市| 绵阳市| 咸丰县| 莱阳市| 大余县| 抚州市| 尚志市| 西安市| 贺州市| 嵊泗县| 永嘉县| 神池县| 海丰县| 吉林省| 得荣县| 东阳市| 隆安县| 阳高县| 全州县| 当雄县| 上栗县| 广南县| 桓仁| 湘乡市| 镇巴县| 东方市| 班玛县| 公主岭市| 漳平市| 瑞昌市| 潜山县| 苍山县| 会同县| 信阳市| 文山县| 韶关市|