Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why Over riding is Run Time Polymorphism?

Answer Posted / umanath

This is (Run Time Polymorphism) called Dynamic binding.

for more depth see the bellow example

class A
{
public String msg = "message-A";
public void display()
{
System.out.println(msg);
}
}
class B extends A
{
public String msg = "message-B";
public void display()
{
System.out.println(msg);
}
}

class demo
{
public static void main(String as[])
{
A a = new B() //RUN TIME POLYMORFISM
a.display() //Since a is a object type of class B SO class
B sum
System.out.println("From Main: "+a.msg);
}
}

Out Put:
message-B
From Main: message-A

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is string thread safe in java?

1092


Define an abstract class with reference to java.

998


What are the supported platforms by java programming language?

1046


What is native code?

1123


What is the static field modifier?

1131


Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?

1069


can any body body expalin best definitions & best real time exaples for opps concepts.

2269


What are the data types supported by java?

1027


Does anyone still use java?

1117


What is the difference between == and === javascript?

1182


Can constructor be protected in java?

968


What is the final class?

1059


When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

1039


How we can make copy of a java object?

1100


Why do we declare a class static?

1155