Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Greg Brannon wrote:There can only be one public class per *.java file.
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Rusty Neal wrote:I'm a software system engineer by schooling, training and work experience. I am not a programmer, I work at protocol level not language. I decided to teach myself Java so I would be a better software system engineer, which is how and why I obained the book, "Head First Java".
With that said, I'm going through each example in the book trying to figure out what to type and where. I'm using both the command line technique and NetBeans IDE to compare results. I'm stuck though on what the book was instructing us to do, and I can't get my .java files to compile in either environment.
Here is my question, which wasn't clear in the book. When I write the Dog class, then the DogTestDrive class, are these in the same notepad file or should each class be in a different notepad file? I have been able to get the DogClass file to compile which is just the class example for Dog. But the file that I created separately for DogTestDrive (i.e., DogTestDrive.java) is not compiling. So then I put both sets of code in one file (i.e., the class Dog lines then the class DogTestDrive lines after that), which didn't compile either. So I am missing probably a simple point. I did see in the front of the book where one class in one file. So does that mean that one and only one class goes into a file?
Thanks in advance,
Consider Paul's rocket mass heater. |