Abhimanyu Archive

Method overriding in Java

A subclass having a method with the same name as that of its parent class, such that it has exactly the same arguments as that of the parent method, then it is known as method overriding. Method overriding is also called as runtime polymorphism.

Encapsulation and Abstraction

Encapsulation from what you have learnt googling around, is a concept of combining the related data and operations in a single capsule or what we could say a 'class' in OOP, such that no other program can modify the data it holds or method implementation it has, at a particular instance of time.

Understanding instanceof operator in Java

instanceof operator in java is used to compare object reference variables. It can be used to check if the object referenced by any object reference variable is of a particular type. This is also known as the type comparison operator. The instanceof operator evaluates to return either a true or false.

Variable shadowing in Java

If there exists two variables with the same name in a particular scope, one of the variables take the priority while the other one gets hidden or shadowed. This is also known as Variable Shadowing in Java. In the following snippet, we can find the same thing happening.

Initialization block in Java

Just as constructors and methods, initialization blocks also add up to places where an operation can be performed. So there are few rules to keep in mind when dealing with the initialization blocks. But before we do that, we must know that there are two types of initialization block in Java, namely – Static initialization block Instance
Receive our updates to your inbox

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.