We can answer this answer in two ways, Logical way and Physical way, let's take a look at the logical way. 42: invokevirtual #9 // Method org/programming/mitra/exercises/OverridingInternalExample$Human.speak:(Ljava/lang/String )V ![]() 36: invokevirtual #7 // Method org/programming/mitra/exercises/OverridingInternalExample$Human.speak:()V ![]() 23: invokevirtual #4 // Method org/programming/mitra/exercises/OverridingInternalExample$Mammal.speak:()V 10: invokevirtual #4 // Method org/programming/mitra/exercises/OverridingInternalExample$Mammal.speak:()V Code below contains the output and and bytecode of the method callsĪnyMammal.speak() // Output - ohlllalalalalalaoaoaoa Let’s take the example of a parent class MammalĬlasses from our previous blog to understand it more clearly. ![]() In this article, we will see How Does JVM Handle Method Overloading And Overriding Internally, how JVM identifies which method should get called. In my previous article Everything About Method Overloading Vs Method Overriding, I have discussed method overloading and overriding, their rules and differences.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |