Keep getting this error help.

–3 votes
asked Oct 2 by (100 points)
edited Oct 2 by

Main.java:14: error: cannot find symbol
        Dog dogger = new Dog();
        ^
  symbol:   class Dog
  location: class Main

Dog is just another class but I keep getting this error. But if I try to put the Dog class in the same file, I get an error too. 

Here is the link https://onlinegdb.com/HkoGVBM_r

3 Answers

+1 vote
answered Oct 2 by (3,550 points)
Can you please share code by "Share" button?
0 votes
answered Oct 3 by anonymous

Hello, i just used your code try saving the files as " filename.java".

when i did it that fixed your issue for me.

also when validating the choice in the if statement use the .equals() method instead of "==", if you use the "==" method for strings as Strings are objects and not primitives it compares the reference address instead of the value in other words it will always say "that is an improper response".

0 votes
answered Oct 5 by anonymous
The error you are getting is because the compiler is not able to find the reference to 'Dog' and 'Monkey' class.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...