Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

The package keyword

                         

The package in java programming language is a keyword that is used to define a package that includes the java classes. Keywords are basically reserved words which have specific meaning relevant to a compiler. Packages in java are used to avoid naming of classes. 

Syntex:  Here is the syntax that must be followed by a developer whenever defining a package.

package com.roseindia;

public class MyClass

{

}

Note: Here are some points that must be considered while declaring and defining a package.

  • In java programming language while defining a package then the package statement, must be the first non-comment statement in Java source file. For example the above syntax have a fully-qualified class name of the MyClass i.e com.roseindia.MyClass.

  • The class defined in the file goes to the default package if  the Java source file does not include a package statement.

  • Classes in the default package may not be referenced from classes in non−default packages.

 

                         

[an error occurred while processing this directive]