Java Java Basics Perfecting the Prototype String Equality

How do I make the IF statement check secondExample?

The question asks to use an if statement to check if the firstExample is equal to secondExample. So I tried if(firstExample == secondExample) , consoleprintf("the first is equal to the second") but it says its wrong... what did I do wrong?
// I have imported a for you, it is named console. 
String firstExample = "hello";
  console.printf("first is equal to second");
String secondExample = "hello";
String thirdExample = "HELLO";

1 Answer

Steven Parker
Steven Parker
203,717 Points

Just put "secondExample" in the test method instead of duplicating the literal string. Also move the new code down after the variables are initialized.