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 trialJarle Halvorsen
1,316 PointsIt says that I have to use printf and I am and it says use firstExample and I am so I dont understand whats wrong.
This is the code Im using:
String firstExample = "hello"; String secondExample = "hello"; String thirdExample = "HELLO"; if (firstExample.equalsIgnoreCase("hello")) { console.printf("first and third are the same ignoring case."); }
But It says Bummer! You have to use firstExample and use printf. And I am so I don't understand what Im doing wrong
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if (firstExample.equalsIgnoreCase("hello")) {
console.printf("first and third are the same ignoring case.");
}
1 Answer
Jarle Halvorsen
1,316 PointsThank you soo much for your help. But this is part 2 and part 1 was to compare first and second, so if i change "hello" part 1 fails.
Clement THOLLOT
1,203 PointsClement THOLLOT
1,203 Pointsinstead of putting "hello" in the equalsIgnoreCase method, you should simply use the variable name thirdExample, so you compare the firstExample with the thirdExample. Using the variable name will allow future code to always test the equality between these two variables cause maybe in the future thirdExample could change.