Java Blog

 
 
 
 public class JAVA_065
 {

    static int[] values=new int[10];

    int count;

    static
    {
       System.out.println(\"Running static initialization block.\");

       for(int i=0;i<values.length;i++)
          values[i]=(int)(100*Math.random( ));
    }

    {
       System.out.println(\"Running initialization block.\");

       count=10;
    }

    void list_values( )
    {
       for(int i=0;i<values.length;i++)
          System.out.print(values[i]+\" \");

       System.out.println(\"\\nCount = \" + count);

       System.out.println( );
    }


    public static void main(String[] args)
    {
       JAVA_065 obj=new JAVA_065( );

       System.out.println(\"\\nFirst Object : \");

       obj.list_values( );


       obj=new JAVA_065( );

       System.out.println(\"\\nSecond Object : \");

       obj.list_values( );
    }
 }