• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which is the correct option

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which statement is true?
A. catch(X x) can catch subclasses of X.
B. The Error class is a RuntimeException.
C. Any statement that can throw an Error must be enclosed in a try block.
D. Any statement that can throw an Exception must be enclosed in a try block.
E. Any statement that can throw a RuntimeException must be enclosed in a try
block.

can any one tell me the answer of this question?
thanks in advance
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A. catch(X x) can catch subclasses of X.
True

B. The Error class is a RuntimeException.
No , this is like OutOfMemoryException

C. Any statement that can throw an Error must be enclosed in a try block.
I think , No

D. Any statement that can throw an Exception must be enclosed in a try block.
Only checked Exceptions , like IOException

E. Any statement that can throw a RuntimeException must be enclosed in a try
block.
No , Like NullPointerException

Make me correct if i am wrong on any point
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One similar thread.
 
Parambir Singh
Ranch Hand
Posts: 40
Android Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ram, I think you are right.
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes only A is correct
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic