String shovelType;
public Shovel(){
this.shovelType = "dirt";
}
public Shovel(String name, int weight, String color, String shovelType){
super(name, weight, color);
this.shovelType = shovelType;
}
public void useThing(){
System.out.println("Using " + this.shovelType + " ,thank you.");
}
public String getShovelType(){
return shovelType;
}
public void setShovelType(String shovelType) {
this.shovelType = shovelType;
}
} ```
#reached end of file while parsing?
8 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @pastel wagon! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Hover over that error mark under setShovelType and see what it's saying. Also, it looks like you have some "non-breaking spaces" at the end of your file that the compiler is freaking out about. Clear those blank lines at the end and see if it compiles
code works fine for me, not regarding the missing super call in the first constructor
This is a traitorous error. \u00a0 is an invisible character. More exactly a nonnormal space that looks like a space. Better IDEs like IntelliJ highlight them to help seeing that kind of issues.
Anyway, your file contains nonnormal spaces that look like normal spaces. I guess erase them all and type them again.
No idea how you ended up in this situation, but that happens from time to time when copy/pasting code from nonideal sources