Results 1 to 3 of 3
- 03-21-2014, 01:52 PM #1
Member
- Join Date
- Mar 2014
- Posts
- 1
- Rep Power
- 0
- 03-21-2014, 01:59 PM #2
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Static Block in java executes first
Isn't it more useful to you to ask what static initializer blocks are used for? Apparently you don't understand that, or else you wouldn't have to ask this question.
"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 03-21-2014, 03:20 PM #3
Senior Member
- Join Date
- Feb 2014
- Posts
- 219
- Rep Power
- 7
Re: Static Block in java executes first
For background knowledge on static, see
- Understanding Class Members (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
- Initializing Fields (The Java™ Tutorials > Learning the Java Language > Classes and Objects).
After that, take a look at Initialization blocks, constructors and their order of execution for the main reason why static blocks are executed first.
Similar Threads
-
What is the use of Static method and static block
By chandrasekhar.melam in forum New To JavaReplies: 7Last Post: 08-20-2013, 03:44 PM -
Static block execution order diff. for setter-based and constructor-based injection
By suhaas.mohandos@gmail.com in forum SpringReplies: 16Last Post: 08-09-2013, 01:02 PM -
Static Block and variable problem
By phobosforever in forum New To JavaReplies: 1Last Post: 07-04-2011, 02:28 PM -
Catthing errors when java executes
By jchristiansen70 in forum New To JavaReplies: 3Last Post: 09-07-2010, 11:45 PM -
[SOLVED] static block or constructor?
By JT4NK3D in forum New To JavaReplies: 3Last Post: 05-27-2008, 03:21 PM
Bookmarks