0

What is the difference between the static and non static block

how static block is used for initialization

22nd Apr 2017, 3:29 AM
Sandeep Singh Negi
Sandeep Singh Negi - avatar
3 Respostas
+ 7
Static is like puting hospital patients in quarantine so the condition of the patients does not effect people outside of quarantine.
22nd Apr 2017, 3:43 AM
Manual
Manual - avatar
+ 6
Static is isolated non-Static is not
22nd Apr 2017, 3:45 AM
Manual
Manual - avatar
+ 3
The static block is called only once when the containing class is accessed for the first time. Whereas, the non-static block is called every time a new instance is created, just before the constructor. Also visit http://www.bullraider.com/java/core-java/scjp-ocjp/290-static-non-static-block for more detailed comparison
22nd Apr 2017, 6:47 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar