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) Delivering the MVP Wrapping up

Derek Derek
Derek Derek
8,744 Points

What is wrong? I've already added a getter method for both first and last name but I'm not passing the test?

What is wrong? I've already added a getter method for both first and last name but I'm not passing the test?

2 Answers

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hi Jae,

your User class should look like this:

public class User {
    private String mFirstName;
    private String mLastName;

  public User(String firstName, String lastName) {
    // TODO:  Set the private fields here
    mFirstName = firstName;
    mLastName = lastName;
  }

  public String getFirstName() {
    return mFirstName;
  }
  public String getLastName() {
    return mLastName;
  }  
}

It it the same code you have ?

Grigorij

Derek Derek
Derek Derek
8,744 Points

it worked! thank you!