Java OOPs Concept

OOPs stands for Object Oriented Programming language. Everything is an Object in Java so it is easy to extend from when it is based on the Object model.

Object Oriented Programming language mainly supports four principals’ abstraction, inheritance, encapsulation and polymorphism these are also called four pillars of Object Oriented Programming Language.

Abstraction is the method of exposing the essential detail of an entity, whereas ignoring the extraneous details to reduce the quality of the users. It is very simple to understand when you relate it to the world scenario.
For instance when you are going to have drive your car you don’t have to be concerned to the exact internal working of the car. What you are involved with is interacting together with your automotive via its interfaces like hand wheel, foot pedal, gun etc.

Encapsulation is the method of building data and operation on the data along in an entity. In this article we will discuss following concepts of OOPs in Java.

OOPs Concept


Inheritance– Inheritance is the process where one class inherits some properties of another class. Inheritance in Java can be easily understood in the terms of child, parent relationships. The class which inherits some properties of another class that is called child class also called sub class and the class whose properties inherited that is called parent class and superclass.

Let us know how extend keywords used to inherit the property of another class with the help of syntax.


Let’s understand with an example. Consider Vehicle as a superclass, many vehicles have different features but few of them have same like speed, fuel. Color and size. Therefore we can create a class Vehicle and the subclass of this could be any type of vehicle like CAR TRUCK.



Packages– Packages are used in Java to avoid the naming conflict, to make locating/searching and for the use of classes, interface, enumeration etc. A package is also defined as the group of similar types of classes, interfaces, sub – packages and enumerations.

Some existing Java Packages – bundles the input output classes

Java.lang – bundles the fundamental classes

Creating a package with example:



Interface-An interface is same to the pure abstract class but it is not a class. It could have same variable and methods but in an interface the methods declared by default abstract. It is a collection of abstract methods and along with it; an interface can also contain default & static methods, constants and nested types. Writing a class and writing an interface can be same but an interface describes only behavior that a class implements and a class contains behaviors and attributes of an object.



Exception Handling– Exception is like an error that occurs during the execution of a program so that the flow of the application disturbed. To maintain the flow of the application the exception handling used. It is the powerful mechanism in Java. An exception can be occur by some reason like entering the invalid data by user and if the network connections lost in the middle of the communication and if the file does not found when it needs to be open. Exception handling is of two types the first one is Checked exceptions and the second is Unchecked exceptions.




Multi Threading- It is the process of executing the multiple threads at the same time. Java is also called multi threading programming language means it can develop multi develop program. Multithread Java contains more than two threads that can run concurrently cheap rolex replica means that a single program can perform more than two tasks simultaneously.

Some Advantages of Multithreading in Java

In Java multithreading can perform multiple tasks at the same time and it does not block users.

It saves time as it has the feature of doing many tasks simultaneously.

It does not disturb other threads when exception occurs in a thread because they are independent.

Thread Class- Thread Class is like an abject in Java. It is the second way in java to create a extend thread class. Every thread has its own call stack in Java.


Runable- In the new state first thread start its life cycle and remains until the start() method not called on it. After calling start() method and invocation on new thread, the thread go for runable.

Be the first to comment

Leave a Reply

Your email address will not be published.