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 trialMichael Tsaga
20,180 Pointschallenge Task 4of 4 Finally,add the setter
public class Spaceship{ public String shipType;
public String getShipType(){ return shipType; } public void setShipId(int ShipTypeId){ this.shiptypeId=ShiptypeId; } }
public class Spaceship{
public String shipType;
public String getShipType(){
return shipType;
}
public void setShipId(int ShipTypeId){
this.shiptypeId=ShiptypeId;
}
}
mohamadreza azadi
5,167 Pointsmohamadreza azadi
5,167 Pointshey Micheal Tsaga Your variable as String and your setter parameter should be String because you set something into your variable if you want your primitive datatype as int, end of this line type +"". if you didn't want to set the data type to String
public void setShipId(String ShipTypeId){ this.shiptypeId=ShiptypeId; }