class MyException should be declared outside the class TestClassConsider the following code...
public class TestClass{
class MyException extends Exception {}
public void myMethod() throws XXXX{
throw new MyException();
}
}
What can replace XXXX?
About Question enthuware.ocajp.i.v7.2.1347 :
Moderators: Site Manager, fjwalraven
-
- Posts: 7
- Joined: Sat Jan 18, 2014 8:04 am
- Contact:
About Question enthuware.ocajp.i.v7.2.1347 :
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1347 :
Why do you think so?
If you like our products and services, please help us by posting your review here.
-
- Posts: 7
- Joined: Sat Jan 18, 2014 8:04 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1347 :
Is MyException an inner class? I'm not familiar with the conception of inner classes, but they are not in the exam. Is it correct code snippet in this question?
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1347 :
Yes, the code is valid. It is an inner class but that has no bearing on the options because none of the options indicate any possibility that the given code might be invalid. It has now been moved out nevertheless to avoid confusion.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 27 guests