"An Intent is an object that provides runtime binding between separate components (such as two activities). "
Anyone care to explain what runtime binding is?
Runtime binding is the same thing as dynamic binding or late binding. Dynamic binding basically means that the method implementation that is actually called is determined at run-time, and not at compile-time. And that’s why it’s called dynamic binding – because the method that will be run is chosen at run time.
Inheritance creates typecompatibility. It allows a super class reference to refer to the object of sub class. (Reverse is not true).
A super class reference, that refers to object of sub class, can only be used to access the inherited and overrridden methods of sub class. The members newly defined in sub clas are not accessible using reference of super class.
void f1()//this holds address of object of B
class B extends A
void f3()//new method
void f2()//this holds address of object of B
System.out.println("B f2 starts");
System.out.println("B f2 ends ");
public static void main(String args)
A ref; //reference of A
ref = new B();//Object of B
//ref.newMembersOfChild() not allowed
Consider the statement
Here ref is a reference of class A and it has address of object of class B f2() is a overridden method.
When compiler detects such a statement then it doesn't bind the function call with any definition. It only validates the call.
Binding of such calls is left for the runtime environment. At program runtime system identifies the datatype of the object and binds the function call with the function definition provided by the class of object. This type of binding between the function call and function defination is called as "late binding" or "runtime binding" or "runtime polymorphism" or "dynamic method dispatch".
Type your Comment below and click to send comment