Page 1 of 1

Compilation errors in two code examples in ExceptionClassSum

Posted: Thu Dec 15, 2016 1:21 pm
by jankur
Hi,
there are compilation errors "non-static variable k cannot be referenced from a static context" in code examples in the points:
"4. java.lang.ArithmeticException extends java.lang.RuntimeException"
and
"6. java.lang.ExceptionInInitializerError extends java.lang.Error"
in http://enthuware.com/downloads/Exceptio ... ummary.pdf
In both cases the line "public class X { int k = 0; " should be changed to "public class X { static int k = 0; ".

Re: Compilation errors in two code examples in ExceptionClas

Posted: Fri Dec 16, 2016 12:53 am
by admin
You are right. It should be static.

thank you for your feedback!
Paul.