In Java, if name of a derived class static function is same as base class static function then the derived class static function shadows (or conceals) the base class static function. For example, the following Java code prints “A.fun()”
If we make both A.fun() and B.fun() as non-static then the above program would print “B.fun()”.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Covariant return types in Java
- Can we override private methods in Java?
- Object class in Java
- Overriding in Java
- Static methods vs Instance methods in Java
- HashSet vs TreeSet in Java
- ShortBuffer allocate() method in Java With Examples
- IntBuffer duplicate() method in Java with Examples
- ShortBuffer compact() method in Java With Examples
- LongBuffer equals() method in Java