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 trialalex gwartney
8,849 PointsThe quiz is saying that my set method is wrong and i cant seem to see why its not working?
The compiler is also saying i am missing a return statement which also makes no sense since its a setter method.
public class Spaceship{
public String mType;
public String getType(){
return mType;
}
public setType(String mType){
this.mType = mType;
}
}
3 Answers
James Simshaw
28,738 PointsHello,
In
public setType(String mType){
this.mType = mType;
}
the function itself is missing whether you want to return something(and if so, what type) otherwise it needs to be void. For example
public void someMethod(int someInt) {
// Does some stuff but no return statement
}
Please let us know if this clears things up for yourself or if you need more assistance and we can help further.
alex gwartney
8,849 Pointsah ok completely looked over that fact thanks for help.
James Simshaw
28,738 PointsYou're welcome. Have fun with Android development.
alex gwartney
8,849 Pointsi defiantly am so far.