creating_package_2
 

package MyMath;
public class MyPack
{
public int method_1()
{
//System.out.println("Hello World");
int n1 = 10 + 10;
String str = "Hello Wrold Good day";
System.out.println("Hello World");
return n1;
}
}

saved in

Testing MyMath Package and using MyPack class in the folder name MyMath.

//javac Math_Test.java
import java.io.*;
import MyMath.*;
//importing the package not the class
//now create a class that will use this package
public class Math_Test
{
public static void main(String args[])
{
MyPack m = new MyPack();
//m.method();
System.out.println(m.method_1());

}

}
//end of the class

Generates a BAT file tp2base.BAT

shows all the output