Comparison
Equality operator (==
) returns true
when both operands are in the same currency and have an equal amount.
Money values can be compared with the <
, <=
, >
, >=
operators, or the method compareTo()
from the interface Comparable<Money>
.
These operators and method compareTo()
can be used only between money values in the same currency. Runtime error will be thrown on any attempt to compare values in different currencies.
Last updated