• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a package?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to Java in General forum.
Folks their may help you. Java in General
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic