Creating & Using packages in Java is very very simple...
first u have add the "package <package_name>;" line in your every java
program tht u want to add inside a package.
u have to mention the directory while compiling
<syntax>
javac -d <dir_name> <java_file.java>
to run u have to mention package name in command line
<syntax>
java <package>.<main_class>
ex:-
package mypackage;
public class PackageDemo
{
public static void main(String args[])
{
System.out.println("Hello, world!!");
}
}
javac -d C:\JavaDemo PackageDemo.java
java mypackage.PackageDemo