• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Checked and Unchecked Exceptions

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,
Can any one tell me about
method()throws Exception how it going to be worked.
I know to throw a Exception in try catch block, but I don't know how throws Exception works like throws IOException, throws RemoteException.
Please help we in this regard.
Thanks,
Bhargavi.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When a method says it throws an exception, this means that the code inside that method body has the potential to throw that exception. It's a warning to the coder. So when you call that method, you need to deal with the possible exception. For example if int myMethod() throws MyException, then when I call myMethod, I need to take precautions...

Or...

Note in the second case, I didn't do anything to handle a possible exception thrown by calling myMethod. Instead, I simply declared that myOtherMethod might throw that exception. This means that anyone calling myOtherMethod needs to take precautions.
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic