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 Equality Question

Add another if statement that checks if the firstExample is equal ignoring case to thirdExample. If it, is print out "first and third are the same ignoring case

Can someone give me a few pointers but not answers please?

Dov Brodkin
Dov Brodkin
2,695 Points

You have to write an if statement using .equalsIgnoreCase that compares the first and third variable, if it is true, use the console.printf to print out "first and third are the same".

2 Answers

Kourosh Raeen
Kourosh Raeen
23,733 Points

The String class has an equals() method that you can use. I can tell you more if you need me to.

Cindy Lea
Cindy Lea
Courses Plus Student 6,497 Points

I will give you a skeleton format:

if (firstExample is equal to thirdExample) { print a line that says"first is equal to second"); }

Change "firstExample is equal to thirdExample" to java code