java代碼塊 學習
阿新 • • 發佈:2018-06-21
static stat args out java pri TE 構造代碼塊 AR
class Student {
static {
System.out.println("Student 靜態代碼塊");
}
{
System.out.println("Student 構造代碼塊");
}
public Student() {
System.out.println("Student 構造方法");
}
}
class Demo2_Student {
static {
System.out.println("Demo2_Student靜態代碼塊");
}
public static void main(String[] args) {
System.out.println("我是main方法");
Student s1 = new Student();
Student s2 = new Student();
}
}
java代碼塊 學習