Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:27:03+00:00 2026-06-18T00:27:03+00:00

As shown in http://docs.oracle.com/javase/tutorial/java/IandI/override.html , Java does allow Overriding an instance method by an

  • 0

As shown in http://docs.oracle.com/javase/tutorial/java/IandI/override.html, Java does allow

  1. Overriding an instance method by an instance method and
  2. Hiding a static method by a static method

My question is why Java doesn’t allow hiding a static superclass method by an instance method. This could be done like this:

class Base {
    static void foo () {}
}

class Derived extends Base {
    void foo () {}
    void access () {
        foo ();
        Base.foo ();
    }
}

I don’t see any particular issue with the above approach – it is only as “messy/complex” as the (allowed) hiding of statics already is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:27:04+00:00Added an answer on June 18, 2026 at 12:27 am

    I suspect it is to avoid confusion with dealing with the base class. In fact I imagine the designers didn’t see an obvious way this should behave.

    class Base {
        static void foo () {}
    }
    
    class Derived extends Base {
        void foo () {} // say this compiled
    }
    
    Base b = new Derived()
    b.foo(); // should the static or the virtual method be called?
    

    Should b.foo() call Base.foo() or should it potentially call Derived.foo()?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've looked at http://code.google.com/appengine/docs/java/urlfetch/overview.html but the code does not show a pooling example, i
I have downloaded Java API documentation from http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs and have supposedly attached it to
I want to implement the Demo shown at http://tablesorter.com/docs/example-pager.html in a mobile application. I
Seeking help to design a layout as shown here: http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en The major challenge I
The on/off switches shown on http://developer.android.com/design/building-blocks/switches.html#switches are awesome. I can't figure out how to
I'm trying to override the method 'send_confirmation_instructions' as shown here: http://trackingrails.com/posts/devise-send-confirmation-mail-manually-or-delay-them with: def send_confirmation_instructions
i did everything exactly the same as in the cookies example (shown here http://www.atozed.com/intraweb/docs/Develop/Cookies.aspx
I have followed this tutorial http://netbeans.org/kb/docs/websvc/gs-axis.html and successfully created the web service. When i
I have implemented exactly the code which is shown on this page: http://developers.facebook.com/docs/reference/dialogs/feed/ Problem:
I copy the following from source of http://jquerymobile.com/demos/1.0/docs/pages/multipage-template.html <!DOCTYPE html> <html> <head> <meta charset=utf-8>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.