Method in Java
Java Method is a collection of statements that are put together to perform some specific task. To run the methods, it should be called and it returns the value to the caller. Users can pass data to the methods and …
Java Method is a collection of statements that are put together to perform some specific task. To run the methods, it should be called and it returns the value to the caller. Users can pass data to the methods and …
Java Inner class is also known as the nested class is a class within the class, method, or block declared inside class or interface. The use of the inner class is to group the classes or interfaces logically in one place …
The access modifiers in Java specifies the accessibility or visibility or scope of a field, method, constructor, or class. Java defines four access modifiers: Following shows their accessibility, default (Same class, Same package) private (Same class) protected ( Same class, Same package, Subclasses) …
An Interface in Java is the same as a class, like any other class, an interface can have methods and Variables. But unlike a class, the method in it is an abstract method (only method signature, contain no body), and also by …
A constructor is a block of codes just like a method in Java. It is a special type of method that is called when an instance of the class (that is object) is created and is used for the initialization …
Java is an Object-Oriented Language. And classes and objects are the fundamental components of OOP’s. Objects are real-life entity and classes are the blueprint for creating an object. For example: consider a class for a car, it has color, some weight, …
Polymorphism means having many forms. The word “poly” means many and “morphs” means forms. In java, it is a concept that allows the user to perform a single action in different ways. Take a real-life example: Consider a man and at …
Data abstraction is the process of hiding the details but only displaying the relevant information to the users, which means hiding the implementation details and displaying only its functionalities. This is one of the main advantages of using abstraction. Abstraction …
Java supports three types of inheritance on the basis of class: single, multilevel, and hierarchical. Whereas multiple and hybrid inheritance is supported through interface only. Types of Inheritance in Java: Single Inheritance Multilevel Inheritance. Hierarchical Inheritance. Multiple Inheritance. Hybrid Inheritance. 1. Single …
Encapsulation is one of the four fundamental OOP concepts. Encapsulation in Java is defined as the wrapping up of data(variable) under a single unit. The use of Encapsulation is to make sure that implementation detail or we can say sensitive data is …