I am working an example from a book, the topic is on packages. The code listed below compiles fine if "package BookPack" is commented out. If package BookPack is not commented out I get the following pre-compile error:
class, interface or enum expected. The book suggests, "create the package directories below your current development directory. Well I think my development directory is the one that contains the .java file I'm working with, in this case that is hsbookdemo.java. The path is listed here:
C:\Documents and Settings\DS\My Documents\NetBeansProjects\HSBookDemo\src\hsbookdemo Now, how do I create a package directory? And where is below? Is the package directory placed here:
C:\....\HSBookDemo\src\hsbookdemo\bookpackage. Where bookpackage is the package directory.
The book also says, " to put the class files into the appropriate directories". I found class files in this path:
C:\....\HSBookDemo\build\classes\hsbookdemo[b] This path has the files: [b] HSBookDemo.rs, HSBookDemo.class, Book.class. The book finally says,"execute the programs from the development directory". Does any of this mean I have to use the command prompt with:
java BookPack.BookDemo. If so, I gave up with the command prompt along time ago and downloaded an
IDE. I use the NetBeans IDE. The code is listed below:
The output works out fine, I don't think it is needed, but here it is anyway.