This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
39. Which of the following statements are true? A) An inner class cannot be defined as private. B) Static methods can be overridden by static methods only. C) Static variables can be called using class name. D) Non static variables can be called using class name. Answer:BC For B, are we saying static method can NOT be overridden. They are just happen to have the same return type, method name, para list if we see two static methods in two classes, right?
Originally posted by Thomas Paul: The rule is that static methods can not be overridden to be non-static.
not quite get it. Mughal's book p181 says 'Any final, static and private methods in a class cannot be overridden'. And in JLS 8.4.6, for static method, it is called 'hiding' not overriding respect to instance method. What we do it havaing such a problem in SCJP exam?
Haining, There's a good chance you won't see a question with similar wording on the real exam. The exam is based on the rules in the JLS; not partial or misleading information. [This message has been edited by Jane Griscti (edited June 17, 2001).]
the answer of the first answer is correct or not can any pls explain more
Joined: Aug 30, 2000
Juanid, 'static' methods belong to the class. Overriding involves 'objects' or 'instances' of a class so technically a 'static' method cannot be overidden although a static sub-class method may 'hide' a superclasses static method. See the Sun Tech Tip Shadowing Hope that helps. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform [This message has been edited by Jane Griscti (edited June 17, 2001).]