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 trialEllie Glover
941 PointsAdd another if statement that checks if the firstExample is equal ignoring case to thirdExample.
Hi is there anything im doing wrong here, the question is "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".
this is the code ive written-
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
if(firstExample.equalsIgnoreCase(thirdExample)); {
console.printf("first and third are the same ignoring case");
String thirdExample = "HELLO";
}
1 Answer
Livia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsYou need to declare variables BEFORE you use them. In this case the thirdExample variable must be declared before the if statement.
Also please don't delete code as you go when completing code challenges. Code from task 1 should still be there when submitting task 2, unless you are explicitly asked to change or delete it. Otherwise tests may fail.