How many java static initializer we can have how it will be executed job interview
641 views · Published 30 November 2012 · 5:16 · Indexed 23 September 2026
Channel: Interview DOT · 2012 · Science & Technology
Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. You can submit your resume for right Job
http://www.interviewdot.com/upload-resume/uploadresume.htm
http://www.interviewdot.com http://www.interviewdot.com http://www.interviewdot.com
Welcome to www.InterviewDot.com
How many Java static initializers we can have ? Java Interview Question and Answer :
A class can have any number of static initialization blocks, and they can appear anywhere in the class body. The runtime system guarantees that static initialization blocks are called in the order that they appear in the source code.
Static blocks are also called as static initialization blocks.
Static {
/// initialization of static variables..
}
Please remember , this code will be executed when JVM loads the class. JVM combines all these blocks into one single static block and then executes.
If you have executable statements in the static block, JVM will automatically execute these statements when the class is loaded into JVM.
If you're referring some static variables/methods from the static blocks, these statements will be executed after the class is loaded into JVM same as above.
You can submit your resume for right Job
http://www.interviewdot.com/upload-resume/uploadresume.htm
http://www.interviewdot.com http://www.interviewdot.com http://www.interviewdot.com
More from this channel
-
2:42
what are different access modifiers core java interview questions and answers
-
1:04
Top Core Java Interview Question and Answer 9
-
1:41
What happens if a java thread throws nullpointer exception interview
-
2:36
how many objects are created in java string str = new Stringabc java interview
-
1:44
What are the features of spring framework interviewdot job portal
-
1:55
What is multithreading wait notify java interview question interviewdot
-
2:12
What is MVC interview question interviewdot job portal
-
2:54
Java Interview Question and Answer Explain Static,Interface,Abstract class