• 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:

Dan Chisholm Comprehensive Exam#1 Q#5

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got this answer right because I have seen this question in dan's topic exams, but I do not understand. Could someone go into a little more detail on why the answer is "E".
Thanks
Chris G.
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chris Gastin:
I got this answer right because I have seen this question in dan's topic exams, but I do not understand. Could someone go into a little more detail on why the answer is "E".
Thanks
Chris G.


The instance initializer of class R invokes method P.m1. The throws clause of method P.m1 declares that P.m1 throws an Exception. Therefore, every constructor of class R must also have a throws clause that declares Exception.
Please see the
Java Language Specification, Section 8.6, Instance Initializers.

An instance initializer of a named class may not throw a checked exception unless that exception or one of its superclasses is explicitly declared in the throws clause of each constructor of its class and the class has at least one explicitly declared constructor. An instance initializer in an anonymous class (�15.9.5) can throw any exceptions.

 
reply
    Bookmark Topic Watch Topic
  • New Topic