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

code problem.help please!!!!

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all,
please confirm the answer with reason:
Question 28: Imagine there are two exception classes called Exception1 and Exception2 that descend from the Exception class. Given these two class definitions: class First {
void test() throws Exception1, Exception2 { . . . }
}
class Second extends First {
void test() { . . . }
}
Create a class called Third that extends Second and defines a test() method. What exceptions can Third�s test() method throw?
Select all valid answers.

1 -Exception1
2 -Exception2
3 -no checked exceptions
4-any exceptions declared in the throws clause of the Third�s test() method.
ans 3
i think it should be 1 & 2.
kriti
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The choice 3 is more appropriate than 1 &2.
As the overriding method test() in class Second is not throwing any CheckedExceptions, The Third class's test() method should not throw any checked exceptions. But it is free to throw any runtime exceptions.
Also remember the overriding method can only throw same checked Exception or subclass of that checked exception or nothing.

------------------
Kishore
 
kriti sharma
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very much kish pamu.
kriti
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kriti,
I'm going to move this post to Certification Study as it's not related to Certification Results.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
Can't .... do .... plaid .... So I did this tiny ad instead:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic