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 Spring Basics Modeling, Storing, and Presenting Data Create a POJO

Surabhi Kalyani
Surabhi Kalyani
575 Points

POJO Error!Help!

Can't seem to figure out what is wrong!

com/teamtreehouse/contactmgr/model/Contact.java
package com.treehouse.contactmgr.model
public class Contact{
  private int id;
  private String firstName;
  private String lastName;
  private String email;
  public int getid(){
    return id
  }
  public String getfirstName(){
    return firstName;
  }
  public String getlastName(){
    return lastName;
  }
  public String getemail(){
    return email;
  }
  public void setid(int num){
    this.id=num;
  }
  public void setfirstName(String firstName){
     this.firstName=firstName;
  }
  public void setlastName(String lastName){
     this.lastName=lastName;
  }
  public void setemail(String email){
     this.email=email;
  }
} 

1 Answer

Seth Kroger
Seth Kroger
56,414 Points

The method names need to be properly camel-cased, i.e., getEmail, getLastName, etc. This is especially important when working with frameworks because they will expect getters and setters to follow this very specific convention. They won't be able to find them if they don't.