Which operator is used to compare two values for equality in Java?

Java Associate Easy

Java Associate — Easy

Which operator is used to compare two values for equality in Java?

Key points

  • The == operator is specifically for comparing equality in Java.
  • Using = is incorrect as it is the assignment operator, not the equality comparison operator.
  • === is not a valid operator in Java, it is used in other programming languages like JavaScript.

Ready to go further?

Related questions