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 8776805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:08:30+00:00 2026-06-13T19:08:30+00:00

After going through 2-3 hour to know, what is the difference between compile-time and

  • 0

After going through 2-3 hour to know, what is the difference between compile-time and run-time. Lastly, i came up with this.

Memory allocated at runtime referred to run-time/dynamic binding and allocated at compile time referred to compile-time/static binding.

and then i tried this example

class myclass {

    void here() {
        System.out.println("Here from myclass !!");
    }

    void here(int i) {
        System.out.println("Here !!" + i);
    }
}

class thisclass extends myclass {

    void here() {
        System.out.println("Here from thisclass !!");
    }
}

public class poly {

    public static void main(String s[]) {
        myclass m= new myclass();
        myclass a= new thisclass();
        m.here();
        m.here(12);
        a.here();
        a.here(13);
    }
} 

So, i also found that myclass a= new thisclass(); is considered to be run-time binding. Since, a is the object of myclass, but suddenly compiler found that, class mis-matched. So, it will be dynamically bind the space of thisclass object.

So, till here, i got the things. But, i found that, another common answer was overloading refer to compile time and overriding refer to run-time. I didn’t get this point.

thisclass a= new thisclass();
a.here();

Is this also called to be run-time binding. ?? Please correct me, if wrote anything wrong here.

  • 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-13T19:08:31+00:00Added an answer on June 13, 2026 at 7:08 pm

    First of all, memory allocation is not in this picture. There is no compile-time memory allocation.

    The question conflates compile-time with static binding and run-time with dynamic binding.

    Static binding happens at compile time; dynamic binding happens at runtime.

    Now, when you write

    myclass m= new thisclass();
    m.here(18);
    

    what happens at compile-time is the resolution of the method signature: you are calling here(int) and that choice is final. This is termed “static binding”. What happens at runtime is method dispatch: the runtime chooses a here(int) implementation appropriate to the runtime type of the object referenced by m. There are two methods to choose from: myclass.m(int) and thisclass.m(int), and the runtime chooses the latter in this particular example. This is termed “dynamic binding”.

    As to your question “is overriding compulsory for dynamic binding”… The Java Language Specification prescribes the rules on choosing the correct method to invoke at runtime. These rules imply a procedure known as “dynamic binding” for the general case. But if you are asking whether any specific process always happens at runtime, the story is different: an optimizing JIT compiler can see that there is only one method to choose from and output a “monomorphic call site” which hardcodes the single choice. Further, it can also inline the entire method into the caller, thereby removing even the call itself.

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

Sidebar

Related Questions

After going through couple of linksI came to know that Perl does the compilation
What is the difference between Spring BeanNameUrlHandlerMapping and SimpleUrlHandlerMapping? After going through some site
After going through the article at http://geekexplains.blogspot.com/2008/06/diff-between-externalizable-and.html , i got to know Externalizable is
I know this question has been asked many times and after going through posts,
After going through a bunch of threads, I know that I need to use
After going through few articles about performance, Not able to get this statement exactly.
I saw this question on the Related section and after going through some of
Is there any difference in Data Abstraction and Information hiding? After going through all
Like seriously after going through this... Easy way to dismiss keyboard? ... I have
I'm trying to run $bundle update, but it errors after going through several gems

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.