Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

Andrew Austin
Andrew Austin
1,597 Points

Compiler 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
STAFF
Craig Dennis
Treehouse Teacher

Unfortunately, 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!

Andrew Austin
Andrew Austin
1,597 Points

Thank you! It worked!

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

I fixed the compiler error. Sorry bout that everyone!