Java = = operator and equals operator

==Operator:

Equals operator:

Output:

false

false

Output:

true

true

Output:

true

true

true

false

Note: A1 and B1 point to the same string, while A2 and B2 point to different strings, so A2 Equals (B2) returns true only for comparison values, and = = returns false for comparison references.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>