毕老师的没错:初始化先执行,代码块后执行.- package com.itheima;
- public class test {
-
- public void funtion(){
-
- System.out.println("代码块初始化");
-
- }
-
- public test(String s)
- {
- System.out.print(s);
- }
-
-
- public static void main(String[] args) throws Exception{
- // TODO Auto-generated method stub
- test tt=new test("构造方法");
- tt.funtion();
- }
- }
复制代码
//无论你怎样交换test()方法和function()方法,执行结果永远是:
C:\Documents and Settings\Administrator\桌面\2 |