Does static
block of class execute before the main method of same class?
Example:
public
class Example {
static
{
System.out.println("hi");
}
public static void
main(String[] args) {
System.out.println("bye");
}
}
The
output of this program is :
hi
bye
My
doubt is why the output was
not:
bye
No comments:
Post a Comment