What does “Throws” do and how is it helpful? [duplicate]
问题 This question already has answers here : The throws keyword for exceptions in Java (4 answers) Closed 6 years ago . I am new to Java and have just came across a tutorial which uses the"Throws" keyword in a method. I have done a little research into this but still do not really understand it. From what I have seen so far, it is telling the compiler that a certain exception may be thrown in that particular method. Why do we need to tell the compiler this? I have made many programs using merely