What are Native methods in Java ?

There may be times when we want to call subroutines which are written in some other language other than Java like C++, VB6 etc. In Java, native methods refer to methods that are implemented in a language other than Java, typically in languages like C or C++. These methods are declared with the native keyword … Read more

What is the use if “instanceof” keyword ?

instanceof” keyword is used to check what is the type of object. F The instanceof keyword in Java is used to test whether an object is an instance of a particular class, interface, or subclass. It is a binary operator that returns a boolean value – true if the object is an instance of the … Read more

What are packages ?

Packages group related classes and interfaces together and thus avoiding any name conflicts. From OOP’s point of view packages are useful for grouping related classes together. Classes are group together in a package using “package” keyword. In Java, a package is a mechanism for organizing classes and interfaces into a hierarchical structure. It helps in … Read more

How can we implement polymorphism in Java ?

Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. There are two types of polymorphism:- Method Polymorphism through overloading. Object polymorphism by inheritance / interfaces. Polymorphism in Java can be implemented through method overriding and interfaces. Here are the two main ways … Read more

How do you implement inheritance in Java?

Inheritance is implemented by using “EXTEND” keyword. In Java, inheritance is implemented using the extends keyword. Here’s a brief explanation of how you implement inheritance in Java: java class ParentClass { // Members and methods of the parent class } class ChildClass extends ParentClass { // Members and methods of the child class } In … Read more