Inner Classes

Q1: Which is true about a method-local inner class?

A It must be marked final.

B It can be marked abstract.

C It can be marked public.

D It can be marked static.

ANS:B - It can be marked abstract.

Option B is correct because a method-local inner class can be abstract, although it means a subclass of the inner class must be created if the abstract class is to be used (so an abstract method-local inner class is probably not useful). Option A is incorrect because a method-local inner class does not have to be declared final (although it is legal to do so). C and D are incorrect because a method-local inner class cannot be made public (remember-you cannot mark any local variables as public), or static.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.