Hi. I am a new user to Java and JBuilder. I had a question about classes. I am doing a simple exercise that has objects as superclass and subclasses. I have a class named Mammal in which two other objects will use.
Mammal class code:
public class Mammal {
String name;
public void sleep() {
System.out.println("ZZZZ ZZZZZZ");
}
}
The two subclasses
Dog:
public class Dog extends Mammal {
public void speak() {
System.out.println("Arf! Arf!");
}
}
MorleySafer:
public class MorleySafer extends Mammal {
public void speak() {
System.out.println("Can I say something?");
}
}
When I try and debugg this project I am getting this error:
"MorleySafer.java": cannot find symbol; symbol: class Mammal at line 1, column 34
I am not sure how to fix this. From my research I think it has something to do with that the two subclasses are not recognizing my Mammal class, but I don't know how to fix this.
Can anyone help me?
Mammal class code:
public class Mammal {
String name;
public void sleep() {
System.out.println("ZZZZ ZZZZZZ");
}
}
The two subclasses
Dog:
public class Dog extends Mammal {
public void speak() {
System.out.println("Arf! Arf!");
}
}
MorleySafer:
public class MorleySafer extends Mammal {
public void speak() {
System.out.println("Can I say something?");
}
}
When I try and debugg this project I am getting this error:
"MorleySafer.java": cannot find symbol; symbol: class Mammal at line 1, column 34
I am not sure how to fix this. From my research I think it has something to do with that the two subclasses are not recognizing my Mammal class, but I don't know how to fix this.
Can anyone help me?