|
-
October 18th, 2011, 09:14 AM
#9
Re: Why we use initialization block
 Originally Posted by ProgramThis
Straight from Java:
Note that Java is defined by its standard (with the book I mentioned as official interpretation).
I find the statement you refer to misleading. What a compiler does or doesn't isn't part of the Java language unless the standard says so. The book I mention has a more accurate description (in 2.5.2 Initialization Blocks),
"It is executed as if it were placed at the beginning of every constructor in the class"
The same sourse states about static initializers (2.5.2 Static Initialization):
"The static initializers are executed after a class is loaded before it is actually used"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|