Why we must handle exception for method not throwing exceptions? [duplicate]
问题 This question already has answers here : use of exception in inheritance (6 answers) Closed 6 years ago . Given public class ToBeTestHandleException{ static class A { void process() throws Exception { throw new Exception(); } } static class B extends A { void process() { System.out.println("B "); } } public static void main(String[] args) { A a = new B(); a.process(); } } Why we should handle the exception at line (a.process()) ?.The method process of class B does not throw exception at all?