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 trialAndrew Austin
1,597 PointsCompiler error for ConferenceRegistrationAssistant challenge, preview button broken.
First, whenever I press the preview button to see my compiler error, I see an empty dark grey window where the error should be. Obviously, this has made it a lot harder to debug my code.
I wrote the following code for the ConferenceRegistrationAssistant challenge of Stage 3 of the Java Objects lesson.
public class ConferenceRegistrationAssistant {
public int getLineFor(String lastName) {
/* If the last name is between A thru M send them to line 1
Otherwise send them to line 2 */
String mLine1;
String mLine2;
int line = 0;
char lineSort = lastName.charAt(0);
if (lineSort <= 'm' || 'M') {
line = 1;
} else {
line = 2;
}
return line;
}
}
I have tried everything I can think of, but without being able to see the errors, I'm stuck.
Thanks, Andrew
2 Answers
Craig Dennis
Treehouse TeacherUnfortunately, ORs do not work that way. It is expecting a boolean and you have a char. You can just use the capital in this scenario, but if you wanted to do this, you would repeat the expression on the right side if the or.
Sorry the compiler didn't work, I will look into it.
Hope it helps!
Craig Dennis
Treehouse TeacherI fixed the compiler error. Sorry bout that everyone!
Andrew Austin
1,597 PointsAndrew Austin
1,597 PointsThank you! It worked!