静态块,实例块

package com.ibm.blunit.luzl;

import junit.framework.TestCase;

class Mugs{
	static{
		System.out.println("static load");
	}
	
	{
		System.out.println("instantiation");
	}
	Mugs(){
		System.out.println("Mugs()");
	}
}
public class TestMe extends TestCase{

	public void testname() throws Exception {
		Mugs mugs=new Mugs();
		mugs=new Mugs();
		mugs=new Mugs();
		mugs=new Mugs();
	}
}



输出为:

static load
instantiation
Mugs()
instantiation
Mugs()
instantiation
Mugs()
instantiation
Mugs()

你可能感兴趣的:(IBM,JUnit)