编译期:检查语法是否正确,如果正确就把其翻译为字节码文件,即.class文件。
1、方法重载
2、泛型(类型检测)
3、继承
运行期:Java虚拟机分配内存,解释执行字节码文件。
1、方法重写
注意,注解和异常有可能是编译时,也可能是运行时。
Public class Test {
//被final修饰的变量是不可变的定值。
public static final int a = 10;
public static final int b = 10;
public static int c = 10;
public static inr d = 10;
public static viod main() {
int num1 = a*b;
int num2 = c*d;
//num1在编译的使用就是确定值100,而num2只有在运行时才能知道其结果。
}
}