Author: Awais Farooq
-
Static Binding and Dynamic Binding
Connecting a method call to the method body is known as binding. There are two types of binding Understanding Type Let’s understand the type of instance. 1) variables have a type Each variable has a type, it may be primitive and non-primitive. Here data variable is a type of int. 2) References have a type…
-
Polymorphism in Java
Polymorphism in Java is a concept by which we can perform a single action in different ways. Polymorphism is derived from 2 Greek words: poly and morphs. The word “poly” means many and “morphs” means forms. So polymorphism means many forms. There are two types of polymorphism in Java: compile-time polymorphism and runtime polymorphism. We can perform…
-
Final Keyword In Java
The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be: The final keyword can be applied with the variables, a final variable that have no value it is called blank final variable or uninitialized final variable. It can be initialized in the constructor…
-
Super Keyword in Java
The super keyword in Java is a reference variable which is used to refer immediate parent class object. Whenever you create the instance of subclass, an instance of parent class is created implicitly which is referred by super reference variable. Usage of Java super Keyword 1) super is used to refer immediate parent class instance variable. We…
-
Covariant Return Type
The covariant return type specifies that the return type may vary in the same direction as the subclass. Before Java5, it was not possible to override any method by changing the return type. But now, since Java5, it is possible to override method by changing the return type if subclass overrides any method whose return…
-
Method Overriding in Java
If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in Java. In other words, If a subclass provides the specific implementation of the method that has been declared by one of its parent class, it is known as method overriding. Usage of Java Method Overriding…
-
Method Overloading in Java
If a class has multiple methods having same name but different in parameters, it is known as Method Overloading. If we have to perform only one operation, having same name of the methods increases the readability of the program. Suppose you have to perform addition of the given numbers but there can be any number of arguments, if you…
-
Aggregation in Java
If a class have an entity reference, it is known as Aggregation. Aggregation represents HAS-A relationship. Consider a situation, Employee object contains many informations such as id, name, emailId etc. It contains one more object named address, which contains its own informations such as city, state, country, zipcode etc. as given below. In such case,…
-
Inheritance in Java
Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of OOPs (Object Oriented programming system). The idea behind inheritance in Java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse…
-
this keyword in Java
There can be a lot of usage of Java this keyword. In Java, this is a reference variable that refers to the current object. Usage of Java this keyword Here is given the 6 usage of java this keyword. Suggestion: If you are beginner to java, lookup only three usages of this keyword. 1) this: to refer current class…