Hi Everyone,
here i'm going to share one question about static block , actually when i wrote a class having static data member declaration and when tried to disassemble the code by using javap tool then i got something confusing ....let me first write a sample code then you guys easily able to aware about my issue..
here i'm writing one
Test class which have a static data member declaration only..
and now here,after disassemble the code using by javap is...
here is fine i have no question regarding above but when i have bellow code.
then after disassembling the above code i found following.
it insert static block here so i'm a bit confused that's why i have a question in my mind that...
1- it is ok, if we do't write any constructor in a class then by default compiler insert a default constructor
2-so can we say here that compiler also insert a static block in the case of static data member declaration with assignment but when i decompile the code and i saw that compiler is not doing this thing
3-only in the above mention condition means if any class having static data member declaration ,disassembler shows the static block.
4-so what is mean here to insert static block and who is responsible for compiler or disassembler(javap)??
please clear my doubt with your valuable answers..
-----------------------------------------
vivek