Course Content

Course Content

Description

Static and Dynamic Binding

From our previous video we learned that what are StringBuffer class in Java and what are StringBuilder class in Java programming. In this video we are going to see that what are Static binding in Java and what are Dynamic binding in Java language.

Connecting a method call to the method body is known as Binding in Java. Static binding in Java programming is also known as Early binding. While Dynamic binding in Java is known as Late binding.

When type of the object is determined at compile time (by the compiler), it is known as Static binding in Java. If there is any private, final or static method in a class, there is Static binding.
Example :
class Dog
{
private void eat()
{
System.out.println("dog is eating...");
}
public static void main (String args[])
{
Dog d1=new Dog();
d1.eat();
}
}
Output :
dog is eating...

When type of the object is determined at runtime, it is known as Dynamic binding in Java programming.
Example :
class Animal
{
void eat() (System.out.println ("animal is eating...");
}
}
class Dog1 extends Animal
{
void eat() (System.out.println ("dog 15 eating...");
}
public static void main(String args[])
{
Animal a=new Dog10;
a.eat();
}
}
Output :
dog is eating...

Hence this was all about Static binding in Java and Dynamic binding in Java programming language. In our upcoming video we will see that about Exception Handling in Java with accurate example for it.

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere