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 trial

Java Java Objects (Retired) Creating the MVP Comparing Characters

KARTIK BHASIN
KARTIK BHASIN
9,299 Points

I have a confusion... the line1 and line2 are just to be printed or are some variables which are to be used further?

Codechallenge for comparing

ConferenceRegistrationAssistant.java
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 */
    int line = 0;
    return line;
  }

}

1 Answer

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

You are expected to use return to return the line number from the method.

Does that help?

KARTIK BHASIN
KARTIK BHASIN
9,299 Points

Thanks Craig that did work... :) , but when I tried to use if(lastName<"M")
it showed me a compiler error, instead I had to use if(lastName.compareTo("M")<0). Does < binary operator not work when comparing a string variable and a string constant as in this case ?