Re: BlueJ Java Packages
"WildBill" <nospam@nospam.com> wrote in message
news:e3u5431lsdiqbgdgjf8f8l6avdbru5mi38@4ax.com...
On Wed, 9 May 2007 14:26:47 -0400, "Oliver Wong"
<owong@castortech.com> wrote:
Have you learned about the "import" statement yet? If not, I
recommend
you keep all your classes in the same package until you've learned about
it. If so, review your notes on it.
Thanks for the reply. This is what I found out.
I did manage to get the link established between the packages. The
info is not clear in the tutorials. But, the way it goes is to create
a driver package and then, from within the package window, create
another package from the drop down <edit> menu. In this new package,
the name of the new package will be coded as the first line in each
class imported or created in the new package. In the original driver
package, the statement <import nameofnewpackage.*;> in the driver
class will cause the link to be established. So, the HW07 driver is
in one package, and the class declarations are in the sister package.
Cool eh?
Yes, this is the correct usage of packages in Java, but it sounds like
the instructions you are following are specific to BlueJ. Ideally, you
should be able to program in Java using only a plain text editor like
"notepad", which case you should understand that you would need to type
the keyword "package" followed by the name of the package at the top of
your class file, and how to manually type in the import statements
wherever they are needed.
When I googled for "java package tutorial", I found this:
http://java.sun.com/docs/books/tutorial/java/package/index.html
- Oliver