Java Method Signature Throws Exception, Implementation does not -
i looking exception 1 method throwing. method looks this:
public void somemethod() throws somecheckedexception{ //dosomething statements //but no statements throws 'somecheckedexception' }
my question is possible make method throw 'somecheckedexception' while implementation not have throw statement @ all.
is wrong put throw exception in signature without implement statement throwing exceptions?
this fine. throw statement in method signature there in case method throws actual exception declared in throws statement , pass handling different class need remember put such method try catch statement when want use it.
Comments
Post a Comment