/*
包的机制:(1)
*/
package lee;
public class PackageTest
{
public void Test(int num)
{
System.out.println("num="+num);
}
} //包的使用:(2)
package lee.sub;
public class SubPackageTest
{
public void sub(int x)
{
System.out.println("x="+x);
}
} //包机制;(3)
package lee;
import lee.sub.SubPackageTest;
public class PackageTest1
{
public static void main(String[] args)
{
PackageTest pc = new PackageTest();
pc.Test(4); /*lee.sub.*/SubPackageTest sb = new /*lee.sub.*/SubPackageTest();
sb.sub(7); System.out.println("Hello PackageTest1...");
}
}
05-07 15:50