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

Kevin McFarland
Kevin McFarland
5,122 Points

Why don't the code challenges allow for proper error detection?

Ok, I've tried finishing this Java Objects course a number of times. The code challenges only give a "Bummer! There is a compiler problem"

Then it says to check the Preview for errors. That doesn't display anything but a blank screen most of the time!

I'm finding these code challenges to be vague at best in terms of what the compiler already sees and what I'm suppose to be coding.

I don't have time to monkey around with forums trying to resolve all issues.

There's a definite need for clarity here. I'm also finding that a lot of concepts are being glossed over, which is leaving some pretty big gaps.

Maybe it's just me... but some of these courses seem awfully ambiguous. Especially in light of the fact that coding syntax is so precise.

Kevin

ConferenceRegistrationAssistant.java
public class ConferenceRegistrationAssistant {



    public boolean getLineFor(char lastName) {
    int line = 0;
    String mAnswer = "";
      if mAnswer.indexOf(lastName) < "M" {
    line = 1;
    }else{
      line = 2;
    }   





    return line;
  }

}

5 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Ohh....also you changed the method signature. I suggest restarting the challenge and not change the type of the parameter from String. In most cases, you should write code inside the method only. I assume the knowledge you might be missing is the ability to get the first character from a string. That looks like this:

char letter = lastName.charAt(0);

I'll see if I can get the changes you made specifically here to produce results in the preview pane, again sorry for the frustration!

All that said your logic looks great! Keep up the hard work!

PS. Chars use single quotes. eg: 'M'

Kevin McFarland
Kevin McFarland
5,122 Points

Hi Craig,

Thanks for your quick response and listening to my whining... I get a little frustrated at times and begin to wonder if I'm getting this stuff!

Thanks,

Kevin McFarland

Kevin McFarland
Kevin McFarland
5,122 Points

Hi Craig,

Your advice and direction solved the problem. One issue I'm having is keeping concepts and sytax straight between the different languages... i.e. Java, Objective-C, Swift etc.

Thanks for the help,

Kevin

Have you tried "preview" section when this happens? It usually give you more info.

Kevin McFarland
Kevin McFarland
5,122 Points

Hi,

Yes... that's part of the the problem I'm having. The Preview isn't showing errors. I noticed that often times you have to click on the Preview button several times before it will refresh and display errors. Sometimes though it won't show errors despite the fact that you continue to receive compile-time errors.

Thanks for your response,

Kevin

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

I think you are missing parenthesis around your expression for the if statement, but you should get a compiler error about that. Let me go recreate and see if I can fix it. Sorry for the frustration!

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

I got the compiler errors showing up for this bug...again sorry for the frustration!