这个com/lzw就是包。
package com.lzw;
public class Math {
public void test1(){
System.out.println("this is math");
}
public static void main(String[] args) {
System.out.println("this not is java.lang.Math class ,so this is com.lzw.Math class");
}
}
import com.lzw.Math;
public class Test1 {
public static void main(String[] args) {
Math math = new Math();
math.test1();
}
}
public class Test2 {
static final double PI = 3.14;
public static void main(String[] args) {
System.out.println(PI);
Test2 test2 = new Test2();
test2.test();
}
public final void test(){
System.out.println("thisi is final function");
}
}
final class Test3 {
int a = 3;
public static void main(String[] args) {
Test3 test3 = new Test3();
test3.a++;
System.out.println(test3.a);
}
}
public class Test4 {
Test5 test5 = new Test5();
public void test(){
System.out.println(test5.a);
}
public static void main(String[] args) {
Test4 test4 = new Test4();
test4.test();
}
public class Test5{
public int a = 5;
}
}