Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1347 :

Posted: Sat Jan 18, 2014 8:11 am
by Kipchakbaev
Consider the following code...
public class TestClass{      
class MyException extends Exception {}      
public void myMethod() throws XXXX{          
throw new MyException();      
}
}
What can replace XXXX?
class MyException should be declared outside the class TestClass

Re: About Question enthuware.ocajp.i.v7.2.1347 :

Posted: Sat Jan 18, 2014 9:24 am
by admin
Why do you think so?

Re: About Question enthuware.ocajp.i.v7.2.1347 :

Posted: Sat Jan 18, 2014 10:11 am
by Kipchakbaev
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?

Re: About Question enthuware.ocajp.i.v7.2.1347 :

Posted: Sat Jan 18, 2014 11:30 am
by admin
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.