Skip to content

Commit ede6298

Browse files
authored
Update README.md
1 parent f71508d commit ede6298

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ On the other hand, if you want to insert an element in the middle of a sequence,
7878
You might start building your program with a LinkedList and, when tuning for performance, change to an ArrayList.
7979
Because of the abstraction via the interface List, you can change from one to the other with minimal impact on your code.
8080

81+
### Relational operators
82+
83+
Relational operators generate a boolean result. They evaluate the relationship between the values of the operands.
84+
85+
A relational expression produces true if the relationship is true, and false if the relationship is untrue. The relational operators are less than (<), greater than (>), **less than or equal to (<=), greater than or equal to (>=), equivalent (==) and not equivalent (!=). **
86+
87+
88+
Equivalence and nonequivalence work with all primitives, but the other comparisons won’t work with type boolean. Because boolean values can only be true or false, “greater than” and “less than” doesn’t make sense.
89+
90+
//: operators/Equivalence.java
91+
public class Equivalence {
92+
public static void main(String[] args) {
93+
Integer n1 = new Integer(47);
94+
Integer n2 = new Integer(47);
95+
System.out.println(n1 == n2);
96+
System.out.println(n1 != n2);
97+
}
98+
} /* Output:
99+
false
100+
true
101+
*///:~
81102

82103
### The static keyword.
83104

0 commit comments

Comments
 (0)