• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol  RSS feed

 
Algirdas Smith
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allright, here's the problem.

I'm starting to learn Java from scratch with the guidance of Heads first java book. I've come to a chapter, where I start to learn about objects and classes.

According to the excercise, I have to create 2 classes and use the method from one class in the another. Here are the source codes:

Dog.Java


DogTestDrive.java


The first class compiles just fine. However, when I try to compile the DogTestDrive.java file, I get this error in the compiler:



What could be the problem and how do I solve it?
Thank you in advance.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One question. In the Dog class, did you intend to have the /* in the code?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the file named "Dog.Java" or "Dog.java"?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The two classes are in the package Dog. You'll have to take that into account when you are compiling them. Specifically, these source files must be in a subdirectory named Dog, and then you must compile this from the base directory of the package.

C:\MyProject> javac Dog\Dog.java
C:\MyProject> javac Dog\DogTestDrive.java

C:\MyProject> java Dog.DogTestDrive
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!