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

Niyamat Almass
Niyamat Almass
8,176 Points

problem

i cannot solve the problem .can anyone solve the problem

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.equals("hello")) {
  console.printf("first is equal to second.");
  System.exit(0);
}

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Niyamat;

There are two issues with your code that are preventing it from passing the challenge. The first is what you are comparing the firstExample to, you want to compare it to secondExample, not the value of secondExample. Make any sense?

Second, the challenge doesn't ask for the System.exit(0); line and won't like that either, so it can be deleted.

Post back if you are still stuck.

Ken