1、普通代碼塊
2、構造塊
3、靜態代碼塊(最先調用,且只調用一次)
public class Demo08 {
/**
* @param args the command line arguments
*/
{
System.out.println("通用代碼塊");
}
static{
System.out.println("靜態代碼塊");
}
public void Demo08(){
System.out.println("構造方法一");
}
public void Demo08(int a){
System.out.println("構造方法二");
}
public void Demo08(int a,int b){
System.out.println("構造方法三");
}
public static void main(String[] args) {
// TODO code application logic here
Demo08 demo=new Demo08();
demo.Demo08();
demo.Demo08(1);
demo.Demo08(1,2);
}
}