Wednesday, 29 July 2009

Java Certification Question 0048

Which of the following statements are true?

1) Static methods cannot be overriden to be non static
2) Static methods cannot be declared as private
3) Private methods cannot be overloaded
4) An overloaded method cannot throw exceptions not checked in the base class


Answer 1:

1) Static methods cannot be overriden to be non static

The JDK1.1 compiler will issue an error message "static methods cannot be overriden" if you atempt to do this. There is no logic or reason why private methods should not be overloaded or that static methods should not be declared private. Option 4 is a jumbled up version of the limitations of exceptions for overriden methods

No comments: