wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How to create a package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to create a package?" Watch "How to create a package?" New topic
Author

How to create a package?

ada choi
Greenhorn

Joined: Sep 08, 2004
Posts: 16
i saw some of the JSR172 codes have this package line in the java codes. What is it for and how do i create a package file?

package example.serverscript.connector;
package example.serverscript.demo;
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Moving this to Java in General forum.
Folks their may help you. Java in General


Spritle Software Blogs
Anamika Agarwal
Greenhorn

Joined: Sep 07, 2004
Posts: 5
package example.serverscript.connector;
package example.serverscript.demo;

These lines indicate that the package example contains a package serverscript which contains another package connector.Similarly for second line the serverscript package contains a package called as demo.
To create a package file u have to write simply a line in the begining of the file.
package packageName;
And u have to create the directory with the packageName and keep ur file there.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Creating a package is as simple as declaring that a class, interface or enum definition belongs in a package as the first non-comment line of code in a source file.In this simple example, class Foo is a member of the fubar package.

You might like to take a look at the "Creating and Using Packages" lesson of Sun's Java Tutorial.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
Don't get me started about those stupid light bulbs.
 
subject: How to create a package?
 
Similar Threads
importing a Class I created
In eclipse how to create a folder with a package and package within a package?
creation of own package
package within a package
MDI Application