• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic