Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (6.5k points)
Is it possible to override a static method in Java?

1 Answer

0 votes
by (11.3k points)
No. You cannot override a static method in Java.

You cannot override a static method because anything static is part of the class and is not part of any objects that may be created during execution. This means that any memory that has to be allocated to a static method is allocated statically i.e at compilation time and not when an object is created or if the method is called through an instance of the object at runtime. Method overriding is a property that can only be achieved when an instance of a class is created.

Inheritance and other aspects of object-oriented programming are fundamental to using JAVA to the fullest extent in any capacity. You can watch this and clear any of the basics you may have doubts in:

Related questions

0 votes
1 answer
0 votes
1 answer
asked May 4, 2021 in Java by sheela_singh (9.5k points)
0 votes
1 answer

Browse Categories

...