Creating java package
Can you please tell me how to create java packages, where to store the package and how to access them later.
Thanks in advance.
To create a package, you simply need to use the package keyword at the top of the file:
When compiled, a directory will be created (using the package name) to store the files using that package.
To access that package later, you need to use the import statement.
That will referance all class files within that package. You can import on one class by using:
thats how i have done it. but when importing the package in a new program i am getting the following msg:
package packname does not exist.
can you tell me where i should store the package
In the classpath. Your package (directory of class files) should be placed in the directory that is specified as your classpath -- the folder that contains you compiled .class files.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)