Are you saying that the static block executes when not debugging, but doesn't when debugging?
Ilya Kalujny
Greenhorn
Joined: Mar 20, 2008
Posts: 9
posted
0
aruna sameera wrote:when i am tring to debug a class which contain a static block it doesn't going to static block?
why is that?
AFAIK, static block is executed when class is first loaded by class loader. Silly suggestion: you have break-point set when this happens?
syruss kumar
Ranch Hand
Joined: Jul 23, 2009
Posts: 87
posted
0
you are right the control will go inside the static block normally while we debug the code.Jus try this.
1.Just put a break point in side the static block and inside test().The control will stay in static block.
2.Then remove the break point from static block and try.the control will stay in test() by printing "Inside static block" .
because the class loader executes static block while the class is created .
All search starts with beginner's luck and all search ends with victor's severly tested.