View Single Post
Old 08-05-2003, 09:07 PM   #18 (permalink)
npa
Code Monkey
 
Join Date: Jul 2003
Location: canada
Posts: 82
npa is on a distinguished road
well that was just my of showing that main() isn't
needed as the jvm loads and runs any "static" blocks
before anything else (including main) so if you
feel like it you do not need to use him (main).

generally you use static blocks for loading
things (i use it to connect to the database),
other people use it to load tables of constants:

Code:
private static final int POWERS_OF_2[];
	static {
		//
		//
		//
		//
		for(int k = 0; k < 32; k++){
			POWERS_OF_2[k] = Math.pow(k, 2);
		}
	}
	
	//
	// now we can referrence powers of two faster
	// than trying to calculate them
	//
}
__________________
direct entry file specification.
npa is offline   Reply With Quote