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

Equals Challenge Task

Not sure what I'm doing wrong here. A bit stuck could use some outside eyes to shed some light on my mistake.

Equality.java
// I have imported a java.io.Console for you, it is named console. 
String firstExample = "hello";
String secondExample = "hello";
if (firstExample.equalsIgnoreCase("secondExample")) {
   console.printf("first is equal to second. Exiting. \n\n");
   System.exit(0);
}
String thirdExample = "HELLO";

Thank you that helped out a lot!

1 Answer

zlatkap
zlatkap
21,494 Points

Hello David! In this assignment, you are comparing variable strings firstExample and secondExample. So you should not use use double quotes on secondExample in brackets. In double quotes, it is considered literal string and not variable.