forum

home / developersection / forums / example of overrinding static method in java

Example of Overrinding static method in java

Anonymous User 2123 10-Oct-2014

i know that we cannot override static methods in java. I read here why:

but can someone explain the following code:

    class A
    {
        public static void a()
        {
            System.out.println("A.a()");
        }
    }  
 
    class B extends A
    {
        public static void a()
        {
            System.out.println("B.a()");
        }
    }

how was I able to override function a() in class B? why did it work here or am I missing something.


java java  oops 
Updated on 10-Oct-2014

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By