Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

exception relatead  RSS feed

 
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.
 
author and iconoclast
Sheriff
Posts: 24218
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.
 
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!