Java Java Basics Perfecting the Prototype Censoring Words - Using String Equality

Ted Clayton
PRO
Ted Clayton
Pro Student 206 Points

Challenge #2 won't run

if (firstExample.equalsIgnoreCase(thirdExample)) { console.prinf("first and third are the same ignoring case. \n\n." );

The code above won't run. What is wrong with it?

remi poolen
remi poolen
1,164 Points

in this particular piece of code you are missing a closing curlybracket on your if-statement ( this one: } ). But i cant see the exact assignment or the errormessage so if this was not the correct solution maybe you can add the link to your exact code in the assignment?

2 Answers

Long Nguyen
Long Nguyen
5,658 Points

You have a couple syntax errors. First you're missing a closing bracket at the end of the if statement (You can always omit brackets if you have single line statements). Second you misspelled printf.

It should look like this:

if(firstExample.equalsIgnoreCase(thirdExample))
{
  console.printf("first and third are the same ignoring case");
}
Ted Clayton
PRO
Ted Clayton
Pro Student 206 Points

Long and Remi, Thank you for the reply. When I ran it yesterday it worked and I corrected printf and ended it with a closing curly bracket.