Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Why Java does not allow overriding a static method?

Pragya Keshap answered on February 4, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • why main method is public static void in java
  • overloading vs overriding
  • Can we override the static method?
  • Java Method Overriding
  • What's method overloading
  • what's method overriding
  • what is overriding in java
  • Describe Methods Overloading in Java
  • Method Overriding
  • can we override the overloaded method in java
  • c# override static method
  • method overriding java
  • Example of Method Overloading
  • Method Overriding in java
  • static method in non static class java
  • Method Overloading in Java
  • what is method overriding in java
  • Java Method Overloading
  • where do you use overriding in framework
  • is overriding only works with inherited methods?
  • Method Overloading in java
  • Swift Overriding Methods and Properties
  • What is the other name of Method Overloading?
  • Why it is not possible to do method overloading by changing return type of method in java?
  • Is it allowed to override an overloaded method?
  • Method overloading#
  • Can you override the static method in Java? if I create the same method in the subclass is it a compile-time error?
  • can you override static methods in java

  • Why Java does not allow overriding a static method?

    0

    To override a method, you need an instance of a class. 

    Static method is not associated with any instance of the class. 

    So the concept of overriding does not apply here.Therefore, Java does not allow overriding a static method.

    https://www.javatpoint.com/can-we-override-static-method-in-java#:~:text=No%2C%20we%20cannot%20override%20static,we%20cannot%20override%20static%20methods.

    Popularity 3/10 Helpfulness 1/10 Language java
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.