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 Build an Interactive Story App The Model-View-Presenter Pattern Adding a Custom Constructor

Compiler 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

Spaceship.java
  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

Hi 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;

Thank you so much Mr. Jason Anello for your help .