We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
see the main method
There it's written that print B*H (if and only if flag ==true)
And since we know that static block gets initialised as soon a s the class is loaded, So, as soon as the class is loaded and the values of B and H are loaded it's checked that is flag still equal to true
I HOPE THAT YOU GOT IT NOW
But still if you have any doubt feel free to ask
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Static Initializer Block
You are viewing a single comment's thread. Return to all comments →
see the main method There it's written that print B*H (if and only if flag ==true) And since we know that static block gets initialised as soon a s the class is loaded, So, as soon as the class is loaded and the values of B and H are loaded it's checked that is flag still equal to true
I HOPE THAT YOU GOT IT NOW But still if you have any doubt feel free to ask