static import – JAVA

static import is used to make the availability of static members of the class in our current source file(.java). Simply when we use import statement then it makes availability of the particular class which is defined in the import statement. Static members of a class are not imported by the simple import statement. Whereas static […]

Stronger and weaker class – JAVA

In case of method overriding the access privilege of the method in the derived class should always be equal or greater than the access privilege of the method in super class.   public           >             protected          >          private strongest                                                          weakest   program: //PROGRAM TO SHOW CONCEPT OF STRONGER AND WEAKER CLASS PREVILEGE […]

Method overriding – JAVA

When we have same name of the method in super and derived class with matching arguments, the method in derived class override the corresponding method in the super class, this concept is called method overriding. And it also known as polymorphism. It can be done in three ways: Method overriding (default) Method overriding using abstract […]

final keyword – JAVA

final keyword has the following uses: If a variable is declared final, its value cannot be changed further in the program.  If a method is declared final, that method cannot be overridden. If a class is declared as final, it cannot be inherited. Program //PROGRAM TO SHOW USE OF FINAL KEYWORD final class A_final { […]

Dynamic method dispatching – JAVA

When we store the instance of derived class in the reference variable of super class, the call which was supposed to refer to the method of super class dispatches dynamically at run time towards the method of derived class. This concept is called dynamic method dispatching. It is a special case of run time binding. […]

Run time binding – JAVA

When we have same name of methods in super and derived class, the method in the super class gets overridden by the method in derived class at the run time, this process is called as run time binding. //program to show concept of Run time binding class Base { public void show() { System.out.println(“show of […]