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 trialJonathan Chaperuka
2,043 Pointsi dont knw waht iam doing wrong here.. help
i dont knw wat m duing here.
public class Spaceship {
public String mType;
public String getType() {
return mType;
}
public void setType(String type) {
mType = type;
}
public String shipType;
public String shiptype;
public class Spaceship{ public String shipType;
public String getShipType() { return shipType; }
public void setShipType() { this.shipType = shipType;
}
1 Answer
Daniel Hartin
5,311 PointsHi Jonathan,
I assume you have simply pasted your code in twice, the top class looks good but the variable name you have used must be shipType not mType (I always use the m prefix for member variable too!) I can't really understand the rest of it as the formatting has gone a little askew but I think you're almost there, the challenges can be a little annoying sometimes when they are specific about variables names etc but I suppose it's all good practice for accuracy int eh real world.
I've posted some working code below:
public class Spaceship{
public String shipType;
public String getShipType(){
return this.shipType;
}
public void setShipType(String shipType){
this.shipType = shipType;
}
}
Hope this helps Daniel