Learn Java - Variables - Manipulating Variables

Course URL: https://www.codecademy.com/courses/learn-java/lessons/learn-java-manipulating-variables/exercises/equals
Steps to Reproduce: Use == instead of .equals().

This exercise is all about comparing strings for equality using .equals(). However, the exercise allows you to pass each step using == instead of .equals(), which would normally be erroneous since == does not work with string comparison for equality in Java. Using both == and/or .equals() will work to advance to the next exercise, but it should be limited to .equals().

This image displays one line using == and the other using .equals(), but using == or .equals() on both lines will also allow you to pass.


Good find!!

1 Like