Kamil Hlubek wrote:but what is meaning the fifth number in http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.2?
Don't know, don't care! You don't need to know this for the OCA (or OCP) exam. And I'm a professional
Java developer for 10 years and it's the very first time I see this JLS section. Enough said, isn't it?
But just for fun, I put together a (crazy looking) program
If you run that program, you'll get the following output:
So because of the division by zero (
line1), the initialization of class
X failed, so class
X is in the erroneous state. According to the above application, it seems you can still request some information about this class (e.g. list all fields), but if you do fun stuff (create an instance, print the value of a field,...) you'll get a
NoClassDefFoundError telling you the class was not initialized.
Kind regards,
Roel
PS. This is waaaaaaaaaaaaaay (and I could have added a few more a's if I wanted to
) beyond what you need to know for the OCA (and OCP) exams. I used reflection (to get the declared fields) which is also not on the OCA/OCP exams and was only used for demonstration purpose only.