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 trialMr Sri
9,200 PointsI keep getting the error: "Make sure you are using `equalsIgnoreCase` on the `firstExample` variable and use `console.p"
Can someone tell me why i keep getting the error ?
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if(thirdExample.equalsIgnoreCase(firstExample)){
console.printf("first and third are the same ignoring case");
}
2 Answers
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHello, looks like you have the variables shifted
Try calling equalsIgnoreCase on the firstExample instead of the third.
Steve Hunter
57,712 PointsHi there,
I think it might be beause you deleted the first task's code. I passed the challenge with this:
// 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(secondExample)){
console.printf("first is equal to second");
}
if(thirdExample.equalsIgnoreCase(firstExample)){
console.printf("first and third are the same ignoring case");
}
I hope that helps.
Steve.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsI checked that and it worked fine - that was my first thought too. It seems to be due to the first task's code having been deleted; I tried that too and got the errors described.
Steve.