Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create a package?

 
ada choi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to Java in General forum.
Folks their may help you. Java in General
 
Anamika Agarwal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic