Static methods can't be overridden : overridden method « Object Oriented « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Object Oriented » overridden method 
6.4.5.Static methods can't be overridden
class MyClass {
   static void foo() {}
 }

 class MySubclass extends MyClass {
   void foo() {}
 }
 
 
 This instance method cannot override the static method from MyClass
6.4.overridden method
6.4.1.Overriden methods
6.4.2.Overridden Methods
6.4.3.Using the same method name with identical arguments and return type is known as overriding.
6.4.4.Java specifies that methods may not be overridden to be more private.
6.4.5.Static methods can't be overridden
6.4.6.Exceptions and Overriding
6.4.7.Method Overriding: modify the behavior of one of these methods to suit your new class.
6.4.8.Each method in a parent class can be overridden at most once in any one subclass.
6.4.9.Overriding methods must have argument lists of identical type and order.
6.4.10.The return type of an overriding method must be identical to that of the method it overrides.
6.4.11.Methods marked final may not be overridden.
6.4.12.The accessibility must not be more restrictive than that of the original method for overridden method.
6.4.13.Method may throw only checked exception types that are the same as, or subclasses of, exception types thrown by the original method for overridden method.
6.4.14.Overridden methods support subclass of the return type of the superclass version.
6.4.15.Invoking Overridden Methods with super.
6.4.16.super invokes the version of this method that is next up the hierarchical tree
6.4.17.An overridden method is replaced by the overriding method unless the overridden method is deliberately invoked from within the subclass.
6.4.18.The overriding and overridden methods must have the same return type.
6.4.19.The throws clause of the overriding method must only specify exceptions that are in the throws clause of the overridden method.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.