Originally posted by Prasanna Rajaperumal:
Static blocks are executed first when you class is loaded into the JVM.
(not a necessary, but is ensured to be executed before any other code in the class).
Non-static class level blocks are executed before the constructor of the class is called, when an instance of the object is created.
The super class constructor is called (default no-arg constructor) before subclass constructor.
Now apply these facts, you will arrive at the output.
Originally posted by Henry Wong:
When you compile a program, compilation errors are listed with error messages? What is the message that you got when you compiled it? And what about it do you not understand?
And .... Please Quote Your Sources.
Thanks,
Henry
Originally posted by Jesper Young:
'iamprotected' is a method in class Alpha. You can't assign a value to 'iamprotected' as if it is a member variable.
The statement 'this.iamprotected = 10;' also will not compile.