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

  • SEARCH
  • Home
  • 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 8532095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:38:07+00:00 2026-06-11T09:38:07+00:00

I have read in multiple places that final methods are early bound but none

  • 0

I have read in multiple places that final methods are early bound but none offers a satisfactory reason. I doubt how can it be so coz even in a final method called on parent class reference, compiler cannot say whether parent’s non final or child’s final method is called.
Please advice.

class Parent {
    void meth() {
       System.out.println("parent");
}
}

class Child extends Parent {

@Override
final void meth() {
    // TODO Auto-generated method stub
    System.out.println("child");
}

public static void main(String[] args) {
    Parent parent = new Parent();
    Parent child = new Child();
    child.meth();
    parent.meth();
}
}  

In the above code method meth() called on child(a Parent reference) is a final method but then the JVM should need to use a method look up table at run time as in its the child or parent method being called.

  • 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-11T09:38:08+00:00Added an answer on June 11, 2026 at 9:38 am

    Binding in java happens in two stages. At compile time the type of the reference as known to the compiler is used to bind the method to the highest method up the type hierarchy it can be. E.g. if calling toString() on a Number type variable, then the compiler knows it has to call Number.toString() or a sub-class override rather than Object.toString().

    Secondly when invoking the method at runtime, the runtime type of the object is looked at and the most specific method in the type hierarchy is found and invoked. I.e. in the case of Number.toString above, if the object is an Integer it will find Integer.toString and call that.

    If the method is final in the type of the reference / variable then this second step can be skipped because we know there can be no sub-class override. This is what Dima Rudnick means by the static type. So again with my example, if Number.toString was final, and the variable was type Number then we don’t need to look at the runtime type to know what method we’re invoking.

    Note: for the purposes of this I’m assuming Object, Number and Integer all have a specific toString method rather than relying on the inherited one.

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

Sidebar

Related Questions

I read at multiple places that Boost.Signals is not threadsafe but I haven't found
I am learning GWT and i have read at multiple places that using MVP
If we have a website with multiple images and videos, I've read that it's
I have read some of the questions and answers here, but it none match
I have read it here : CodeProject and some other places that there should
I've read multiple places that you shouldn't store arrays in a mysql db. So
I have read multiple articles about why singletons are bad. I know it has
Thanks for reading. I have done a search, read multiple posts (lost count) and
I have read few articles about table partioning but still I am bit confused
We have WebRole, that hosting multiple sites. We made startup tasks for each site

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.