Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Binding

    • 0
    • 3
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 321
    Comment on it

    Binding

    Connecting two or more separate methods together is known as binding.
    In Java there are two types of binding:
    1. Early binding.
    2. Late binding.

    Early Binding

    The binding which takes place at compile time is called early binding.
    The early binding in Java connects method call and a method body at compile time.

    For static method calls, final method calls and private method calls Java does early binding.

    Early binding is also referred to as static binding or compile time binding.

    Example of Early Binding:

    class Run
    {
    Public static void main(String[] args)
    {
    test1(20);
    test1();
    test1(30);
    test1(20,40);
    }
    static void test1()
    {
    System.out.println("test1()");
    }
    static void test1(int a)
    {
    System.out.println("test1(int)");
    }
    static void test1(int a, int b)
    {
    System.out.println("test1(int, int)");
    }
    }
    

    Late Binding

    The binding which takes place at run-time is called late binding.

    In late binding java connects method call to a method body at the time of execution/run-time.

    Late binding is also referred as dynamic binding or run-time binding.

    Example of Late Binding:

    class D
    {
    void test1()
    {
    System.out.println("test1() in class D");
    }
    }
    class E extends D
    {
    void test1()
    {
    System.out.println("test1() in class E");
    }
    class Run
    {
    public static void main(String[] args)
    {
    D d1 = new E();
    d1.test1();
    }
    } 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: