Package in Java

A package is a collection of similar types of classes, interfaces, and sub-packages. and in normal computer language, it is called a folder that contains the classes. Purpose of package The purpose of package concept is to provide common classes and interfaces for any program separately. In other words, if we want to develop any... Continue Reading →

Exception in Java

What is an Exception? An exception is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled. An exception can occur for many reasons like if a user enters... Continue Reading →

Files and I/O in Java

When you want to access any file or resource in java, there already in-Built Classes that we can use in our program to create I/O mechanism. All these streams represent an input source and an output destination. The stream in the package supports many data such as primitives, object, localized characters, etc. Stream A stream... Continue Reading →

Interface in Java

An interface is a collection of abstract Methods and static final(Constant) Variables. The interface is a mechanism to achieve fully abstraction in java. There can be only abstract methods in the interface. It is used to achieve fully abstraction and multiple inheritance in Java. interface interface_name{ static final data_type variable_name; return_type method_name(parameter); return_type method_name(parameter); } Example: interface... Continue Reading →

Abstract Class in Java

Class that contains at least one Abstract method is referred to as Abstract class. Now, What is Abstract Method ? , When a Parent is quite sure that the implementation of the method will be provided by the child and implementation of the method by each of the child should be unique. abstract class Plane{ abstract void... Continue Reading →

Polymorphism in Java

Polymorphism made of two words poly means many and morph means forms. so we can say that the ability to have more than form is called as polymorphism. Polymorphism is the OOPs concept, and in Java, it can be implemented using method overloading. Example: here is the example of polymorphism class Person { void walk() {... Continue Reading →

Method Overriding

In Inheritance, we saw that how a parent class properties or functions we can derive in the child or derived class. Now to understand the concept of Method Overriding child class must derive the property of the parent class and the condition is we need to keep the Name of the Method and Parameter should be... Continue Reading →

Inheritance in JAVA

Inheritance is the process of obtaining the data members and methods from one class to another class. It is one of the fundamental features of object-oriented programming as we learned. Syntax : class Subclass/Parentclass-Name extends Superclass/Childclass-Name { //methods and Data } In the inheritance, the class which gives data members and methods is known as base... Continue Reading →

Encapsulation in JAVA

Encapsulation is a process of wrapping of data and methods in a single unit. Encapsulation is achieved in java language by the class concept. We can call it as the process of providing controlled access to the private members of a class by the method/ function of that class. In Encapsulation, we will make the Instance... Continue Reading →

Powered by

Up ↑