• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Mock question

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
given the question below , I would choose B is the only answer, but I am not sure if I am right in this case.
Anybody please clarify this.
thanx
9)
Given that a java.io.IOException might occur when calling the read() method of the BufferedInputStream, you can handle the exception by:
a) Catch a java.io.EOFException using a try/catch clause.

b) Catch a java.lang.Exception using a try/catch clause.

c) Listing a java.io.EOFException in a throws list.

d) Catch the java.lang.Exception using the throw statement

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SeaHawk,
"a" and "c" can't be correct because of the folowing hierarchy
+--java.lang.Exception
|
+--java.io.IOException
|
+--java.io.EOFException
"b" is quite obvious and is correct!!
For "d" Catch the java.lang.Exception using the throw statement - U can't catch an exception by using the throw keyword so unless it is something else, this is also wrong.
So, B is the only correct answer!!
Ankur
[This message has been edited by Ankur (edited July 03, 2000).]
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic