类私有构造函数时初始化的进行


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
public class Log{

    private int count;

   static{
        setCount( 1 );  //通过static构造程序块进行初始化,与匿名类的初始化一样.
    }

  private Log(){
    
  }
 
 public setCount( int count ){
    this.count = count;
}
}

注:
   static{
        setCount( 1 );  //通过static构造程序块进行初始化,与匿名类的初始化一样.
        System.out.println( "initialization...' );
        System.exit(0);  //即使没有main函数也能执行
    }