Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Basics Perfecting the Prototype String Equality

is there a problem with the program checking equalsIgnoreCase?

I don't understand why I am getting this wrong. I got the first part correct with firstExample.equals then simply changed it to firstExample.equalsIgnoreCase(thirdExample) for this part, and it doesn't go through. I checked spelling and everything, and it still isn't right. What did I do wrong here?

Equality.java
// I have imported a java.io.Console for you, it is named console. 
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";

if (firstExample.equalsIgnoreCase("thirdExample"))
{
    console.printf("first and third are the same ignoring case"); 
}

So I went ahead and got rid of the quotes around thirdExample, but it still doesn't go through. Is there anything else I could do?

1 Answer

John Lack-Wilson
John Lack-Wilson
8,181 Points

Your code is correct (after removing the quotes from thirdExample), I believe the problem here is that you may have deleted the code from the first challenge. If you put the if statement from task one back in above the second task's if statement, you should pass the challenge.

Thank you so much John!