>
, Greater than, returns true
if the value on the left is greater than the value on the right.
<
, Less than, returns true
if the value on the left is less than the value on the right.
>=
, Greater than or equal to, returns true
if the value on the left is greater than or equal to the value on the right.
<=
, Less than or equal to, returns true
if the value on the left is less than or equal to the value on the right.
==
, returns true
if two values are equal.
!=
, returns true
if two values are not equal.
Do not use ==
or !=
to compare strings.
Instead, you can compare one string to another by calling equals()
from one of them.
String str1 = "hello";
String str2 = "hello";
str1.equals(str2); // true
!str1.equals(str2); // false
You should know about how memory is being allocated. but 目前老师并没有讲
See you in workbook 3.1