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 trialFrancis Dwyer
Courses Plus Student 193 PointsTried every combination
I'm either not understanding what you want or I have done something wrong. I have tried everything I can think of, preview is a blank page.
// 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"));
if (secondExample.equalsIgnoreCase("hello"));
if (thirdExample.equalsIgnoreCase("Hello"));
{
console.printf ("first and third are the same ignoring case");}
5 Answers
turaboy holmirzaev
19,198 Pointsif statement syntax is: if (condition) { expression; }; So check first one thing and do some operation based on that check and if needed other checks. String firstExample = "hello"; String secondExample = "hello"; String thirdExample = "HELLO"; if (firstExample.equalsIgnoreCase(secondExample)) { console.printf("equal"); } .....
turaboy holmirzaev
19,198 Pointsjust add another if statement the same way:
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if (firstExample.equalsIgnoreCase(secondExample)) {
console.printf("first is equal to second");
};
if (..........first and third) {
console.printf("...");
};
if you do that your program will first check the first "if" statement and may do or may not do some operations based on the condition and then goes to the second "if" statement does the same thing
Francis Dwyer
Courses Plus Student 193 PointsOver the class, I just unsubscribed, thanks for trying. This didn't work either by the way.
Lauren Moineau
9,483 PointsFrancis Dwyer Give it another go, it will work. turaboy holmirzaev did not provide you with the full answer, but just gave you a hint to complete the second if-block yourself. So you'd need to modify that second if-block he wrote. The second challenge should have 2 if-blocks. You can do this!
turaboy holmirzaev
19,198 Pointsfirst challenge:
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if (firstExample.equalsIgnoreCase(secondExample)) {
console.printf("first is equal to second");
};
Francis Dwyer
Courses Plus Student 193 PointsIt's the second challenge
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Pointsturaboy holmirzaev and Francis Dwyer this is my version
Part 1
// 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");
}
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 PointsPart 2
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
//first part
if(firstExample.equals(secondExample)){
console.printf("first is equal to second");
}
//second part
if(firstExample.equalsIgnoreCase(thirdExample)){
console.printf("first and third are the same ignoring case");
}
Francis Dwyer
Courses Plus Student 193 PointsFrancis Dwyer
Courses Plus Student 193 Pointsdid that didn't work