forum

Home / DeveloperSection / Forums / Example of Overrinding static method in java

Example of Overrinding static method in java

Anonymous User178710-Oct-2014

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

but can someone explain the following code:

    classA
    {
        publicstaticvoid a()
        {
            System.out.println("A.a()");
        }
    }  
 
    classB extends A
    {
        publicstaticvoid 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.


Updated on 10-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By