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

Android

Muhamed Asil
Muhamed Asil
7,453 Points

The 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

You have the S in SetType capitalized.

Try setType?

Seth Kroger
Seth Kroger
56,413 Points

It should be "setType" with a lowercase s. Only class (or constant, or interface) names start with a capital letter.

Frantyk Andrii
Frantyk Andrii
35,423 Points

Bummer! 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
Seth Kroger
56,413 Points

It 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