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 trialVaibhav Gaur
750 PointsCompiler Error
I'm unable to solve the error !!
ERROR IS :-
JavaTester.java:63: error: constructor Spaceship in class Spaceship cannot be applied to given types;
Spaceship ship = new Spaceship();
^
required: String
found: no arguments
reason: actual and formal argument lists differ in length
1 error
import java.util.*;
public class Spaceship
{
static public String shipType;
static public String SHUTTLE;
public Spaceship (String SHUTTLE)
{
this.shipType = SHUTTLE;
}
public String getShipType() {
return shipType;
}
public void setShipType(String shipType) {
this.shipType = shipType;
}
}
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Vaibhav,
For task 1 the constuctor is not supposed to take any arguments so you shouldn't have anything in the parentheses.
Also, you have to set the shipType equal to the string "SHUTTLE" so you need to have quotes around it.
It probably won't hurt the challenge but you don't need this line static public String SHUTTLE;
Vaibhav Gaur
750 PointsVaibhav Gaur
750 PointsThank you so much Mr. Jason Anello for your help .