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

String equal to a string.

I need help with writing statements were strings are equal to strings. The course content gave an example of a statement that excludes content. But I'm fumbling how to transfer this to two strings with duplicated content.

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 (string.second

2 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

You want to call equals method on the firstExample.

That hint help?

David Chi
David Chi
5,598 Points

Awesome to see you on the forums. Thank you for explaining things in such a clear and concise manner. Because of you I'm going to extend my membership past the trial.

Hi Craig, Thank you for the response!

Alas ... I got through the example by looking up someone else's exercise. Although I got through the exercise, the hint provided isn't jogging any bells.

From an educational standpoint, I think it's because I'm still so new to Java, and basic instructions like "call equals method" are still foreign to me.

Sorry.

Best, Amy

David Chi
David Chi
5,598 Points

Look up equals() and equalsIgnoreCase() methods for strings.