Compilation errors in two code examples in ExceptionClassSum

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
jankur
Posts: 11
Joined: Wed Dec 07, 2016 3:21 pm
Contact:

Compilation errors in two code examples in ExceptionClassSum

Post 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; ".

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: Compilation errors in two code examples in ExceptionClas

Post by admin »

You are right. It should be static.

thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 15 guests