• Post Reply Bookmark Topic Watch Topic
  • New Topic

cant find symbol problems  RSS feed

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have these errors refering to two different subclasses that are calling methods from the superclass.

I may not have a great understanding about calling methods from a superclass to a subclass yet.

The other one is about unfound variables that I have declared even inside the method being used:



C:\Documents and Settings\ben\Desktop\park>javac BenHultinWeek5CatMouse.java
.\Cat.java:6: cannot find symbol
symbol : class Mammmal
location: class Cat
Mammmal mammal = new Mammal();
^
.\Mouse.java:5: cannot find symbol
symbol : class Mammmal
location: class Mouse
Mammmal mammal = new Mammal();
^

.\Cat.java:25: cannot find symbol
symbol : variable selectedMouse
location: class java.util.ArrayList<Mouse>
mouseWeight = Mammal.getWeight(mice.selectedMouse);

.\Mouse.java:41: cannot find symbol
symbol : variable mouse1
location: class java.util.ArrayList<Mouse>
boolean mouse1Sex = Mammal.getIsMale(mice.mouse1);
^
.\Mouse.java:42: cannot find symbol
symbol : variable mouse2
location: class java.util.ArrayList<Mouse>
boolean mouse2Sex = Mammal.getIsMale(mice.mouse2);
^




Here is my Cat.java file:




here is my Mouse.java file:




Thanks a lot for the help
 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you are not importing the class Mammmal in Cat. these all are Compilation errors . why cant you use a IDE like Eclipse ?
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first check the class file of Mammal is present in the same folder or not.
my be this is becouse you not comiled the mammal class.
first compiled the mammal class then try to compile the mouse /cat class.
if you alredy compiled the mamal class then also same error is comming then add that class to your class path..
by using the -cp/-classpath option in javac
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You spelled Mammal wrong.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!