• Post Reply Bookmark Topic Watch Topic
  • New Topic

exception relatead  RSS feed

 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have two classes A,B.
class A extending Exception class and class B extending the RuntimeException ,what is the difference between these two.

cheers,
babu.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A is a "checked exception", B is an "unchecked exception". Methods that throw A must declare that they do so; methods that throw B are not required to declare anything. If you call a method that declares that it throws a checked exception, you must catch it, or in turn, declare that your calling method also throws this exception.
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Babu Lal it seems that you are not practicing the codes this is a request pls check ownself. It seems that you are not working in that. This will be usefull for us if you first scratch yourself.

Cheers Babu Lal Ji
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although I think Ernest Friedman-Hill has given a satisfactory solution for your problem. This is the basic difference between Checked Execption and Unchecked Execption if you are handling Checked Execption then you have to handle it.

Hopes it solve your confusion.
Cheers Babu Lal Ji
Be Happy Babu Lal Ji
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also please specify the Problem header correctly. As you have written Exception Related now pls specify either Diff between Checked and Unchecked Exceptions.
CHeers Babu Lal ji.
Don't Worry Babu Lal Ji
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!