• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol  RSS feed

 
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.
 
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?
 
lowercase baba
Bartender
Posts: 12589
50
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the file named "Dog.Java" or "Dog.java"?
 
Java Cowboy
Sheriff
Posts: 16078
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
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter
https://coderanch.com/t/690611/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!