A question from Marcus exam:
Question 44)
Which of the following statements are true
1) An inner class may be defined as static
2) There are NO circumstances where an inner class may be defined as private
3) A programmer may only provide one constructor for an anonymous class
4) An inner class may extend another class
The answer is:
1) An inner class may be defined as static
4) An inner class may extend another class
A static inner class is also sometimes known as a top level nested class. There is some debate if such a class should be called an inner class. I tend to think it should be on the basis that it is created inside the opening braces of another class. How could a programmer provide a constructor for an anonymous class?. Remember a constructor is a method with no return type and the same name as the class. Inner classes may be defined as private
I understand that these definitions are little bit personal but from exam point of view, would it be correct to include option 1 in the answer?
Thanks
[ June 16, 2003: Message edited by: Barkat Mardhani ]