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 trialMuhamed Asil
7,453 PointsThe naming convention is 'setVariableName' (without the 'm' prefix).
What's the problem please?
public class Spaceship{ public String mType;
public String getType(){ return mType; } public void SetType(String type){ mType = type; } }
3 Answers
bzfchen
6,484 PointsYou have the S in SetType capitalized.
Try setType?
Seth Kroger
56,413 PointsIt should be "setType" with a lowercase s. Only class (or constant, or interface) names start with a capital letter.
Frantyk Andrii
35,423 PointsBummer! The naming convention is 'getVariableName' (without the 'm' prefix).
What's the problem please?
public class Movie
{
private String mTitle;
private int mYearReleased;
public String gettitle() { return mTitle; }
public void settitle(String title) {
mTitle = title;
}
public int getyearreleased() { return mYearReleased; }
public void settemperature(int yearreleased) {
mYearReleased = yearreleased;
}
}
Seth Kroger
56,413 PointsIt needs to be camel-cased, not all lowercase. The method names are just the field name with the 'm' replaced with 'get' or 'set' with the casing left as is. (ex. for mYearReleased, get methods are named getYearReleased and setYearReleased