Good day. There is an example:
public class Application { public static void main(String[] args) throws Exception { g(); } public static void g() throws Error { } }
Please tell me why this code is compiled? I read Horstmann and see: "The compiler strictly follows the throws specifiers. Calling a method that generates a controlled exception, you must either process it yourself, or delegate processing to another method." It turns out that it is not necessary to handle all uncontrolled exceptions from the Error and RuntimeException classes? And we also have a main method that throws a controlled exception:
public static void main(String[] args) throws Exception
Is it not necessary to process it somewhere? I read and do not understand how to interpret the meaning correctly. Please tell us how to act in this example and in general.