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 trialNorbert Weinkauf
Courses Plus Student 2,293 Pointswhy this? There was a communication problem
whats the problem?
// I have imported a java.io.Console for you, it is named console.
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if(firstExample.equalsTo(secondExample))
console.printf("first is equal to second");
5 Answers
Jennifer Nordell
Treehouse TeacherHi there! I'm not sure exactly why you're receiving a communication error. That is not what I receive when I try your code. Your code does, however, contain two errors. You have omitted the open and closed curly braces around your if
body and equalsTo
is not a valid string method. You are looking for equals()
.
Here's some pseudocode:
if(string1.equals(string2)) {
//do something here
}
Hope this helps, but let me know if you're still stuck!
Norbert Weinkauf
Courses Plus Student 2,293 PointsThanks for the quick answer, Jennifer.
But for one line after the if-statement I do not need the curly brackets?
Anyway always something like "oh no! communication problem... write an email at help. . " pops up.
So there are no error hints or corrections or something else. It just doesnt work. I am using firefox. maybe this is the problem? or some browser settings?
Jennifer Nordell
Treehouse TeacherI sincerely doubt it's anything to do with your browser but rather with the inability of the code to compile. Have you tried restarting the challenge and refreshing the page?
I'm not sure what you mean by "for one line after the if statement", so I'll try my hint again.
if(thisThingIsTrue) {
// code that executes if it is true
}
Norbert Weinkauf
Courses Plus Student 2,293 PointsI mean: if(age<2){ console.printf("it is a baby.") }
is the same as
if(age<2) console.printf("it is a baby.") //if there would be another line I would need the curved brackets
Even if it would be wrong some message should pop up. it doesnt compile.
Jennifer Nordell
Treehouse TeacherIf you're still receiving a communication error and you've tried restarting the challenge and refreshing the page, then you will likely have to contact support at help@teamtreehouse.com.
originally posted a statement saying that every if statement needed an open and closed curly brace, but apparently this was false
edited for accuracy
I stand corrected. I may have been confusing it with another language. You have my apologies. But you must still change the equalsTo
to equals
.
Norbert Weinkauf
Courses Plus Student 2,293 PointsThanks again, Jennifer, for your quick help.
I should have had contacted the Support instead of posting here. ...and I haven't done it yet....
But the communication Problem of the "Code challenges" seems to be a browser Problem. In Microsoft Explorer, it works in Firefox not.
Jay Padzensky
4,731 PointsI may recommend trying Google Chrome, as this browser tends to offer the smoothest experience with our app. If you prefer Firefox, try the Challenge again from a private viewing window. This will disable plugins/extensions that could hamper the CC's ability to properly test.