My Data Structure First Lab

Mubashir Ibrahim
3 min readNov 5, 2019

--

The Topic I learned from my First DSA lab was OOP.With the help of OOP we can solve our Programming problems . OOP is a Full form of Object-Oriented Programming.It refers to a type of computer programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure.

OOP contains sub-topics like:-

1-Polymorphism:-

It is used for method overloading. Polymorphism is the ability of an object to take on many forms. The most common use of Polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

Polymorphism in JAVA

As I have learned it in Java so Java supports 2 types of Polymorphism:-

(i)-Compile time:-

Occurs during the time of Compilation.

(ii)-Run time:-

Occurs during during Execution of Program.

2-Inheritance:-

Inheritance in Java is a mechanism in which one class acquires all the properties and behaviors of a parent class. It is an important part of OOP. The idea behind it is that you can create new classes that are built upon existing classes.

For Example we want to access the variables and Method of Parent class in Child class then it will be done by using “extends” keyword.

Java doesn’t support multiple inheritance.Means you can’t extends multiple classes in a single Class.But a single class can be extended by multiple classes.Means Parent class can be extended by Child-1 class and Child-2 class at the same time.

Defined by Picture

3.Abstraction:-

Abstraction is selecting data from a larger pool to show only the relevant details to the object. It helps to reduce programming complexity and effort.

Abstraction can be achieved by not defining a method or Function in Coding or We can also call it like only Creating its instance but didn’t define its Implementation. It is very Important and helpful in java. Abstraction can be found in Abstract classes and Interfaces.

Abstraction Example

4.Encapsulation:-

In Encapsulation we declare the variables of a class as private. Provide public setter and getter methods to modify and view the variables values. It helps our coding to prevent Hacking. So as the members of class are Private so they can’t be accessed outside the class.

An overview of Encapsulation

--

--

Mubashir Ibrahim
Mubashir Ibrahim

Written by Mubashir Ibrahim

Associate Software Engineer at Sibisoft Pvt Ltd | Ex-Teresol | Passionate about Programming & Gaming | Writing about Software Development and Games

No responses yet