Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!