Does Droid.java
contain class Droid
? (it’s case sensitive).
Yes it does, I rechecked the cases of every single class but still I kept getting an error.
Can you link the lesson and share your code (formatted)?
The other thing is to check the directory structure and membership.
Sure! Here it is
https://www.codecademy.com/courses/learn-java/projects/build-a-droid
public class Droid {
String name;
int batteryLevel;
public Droid(String droidName) {
name = droidName;
batteryLevel = 100;
}
public void performTask(String Task) {
batteryLevel = batteryLevel - 10;
System.out.println(name + " is perorming a task " + Task);
}
public String toString() {
return “Hello I’m a droid:” + name;
}
public static void main(String args) {
Droid codey = new Droid(“Codey”);
System.out.println(codey);
codey.performTask(“dancing”);
codey.performTask(“coding”);
}
}
I tried resetting it, and it actually worked. Thanks for the help!