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 trialDorian Ellison
1,367 PointsI need help understanding the 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".
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
if (firstExample == secondExample) {
console.printf("first is equal to second.");
}
String thirdExample = "HELLO";
if (firstExample == thirdExample) {
console.printf("first and third are the same ignoring case.");
}
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Dorian Ellison! Looks like you're doing pretty well! The challenge is asking for you to compare the first example against the third example and print out something if they are equal if you disregard the case. For example, if I don't take capitalization into account then "Tree", "tREE", "TREE", and "tree" should all be the same word.
To do this, you need the equalsIgnoreCase
method. It was introduced in the previous video around the 3:58 mark.
if(firstExample.equalsIgnoreCase(thirdExample)) {
// print your message here
}
Hope this helps!
Dorian Ellison
1,367 PointsDorian Ellison
1,367 PointsI don't think I understand what exactly is being asked of me. Can someone break down the question for me?