Skip to content

saifcse06/java-OOP-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

**JAVA-OOP**

What is OOP?

  • OOP stands for Object-Oriented Programming.
  • Procedural programming is about writing procedures or methods that perform operations on the data, while object-oriented programming is about creating objects that contain both data and methods.

Object-oriented programming has several advantages over procedural programming:

OOP is faster and easier to execute
OOP provides a clear structure for the programs
OOP helps to keep the Java code DRY "Don't Repeat Yourself", and makes the code easier to maintain, modify and debug
OOP makes it possible to create full reusable applications with less code and shorter development time

OOPs (Object-Oriented Programming System)

It simplifies software development and maintenance by providing some OOPs Concepts in Java:

Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation

What are Objects?

Objects are always called instances of a class which are created from a class in java or any other language. They have states and behaviour.

What are Classes?

Classes are like object constructors for creating objects. The collection of objects is said to be a class.

What is Inheritance?

Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. Inheritance also supports hierarchical classification.

There are five types of inheritance

  1. Single
  2. Multilevel
  3. Multiple
  4. Hybrid and
  5. Hierarchical

What is Polymorphism?

Polymorphism refers to many forms, or it is a process that performs a single action in different ways. It occurs when we have many classes related to each other by inheritance. 

Polymorphism in java can be classified into two types:

  1. Static / Compile-Time Polymorphism
  2. Dynamic / Runtime Polymorphism

What is Abstraction?

Abstraction is a process which displays only the information needed and hides the unnecessary information. We can say that the main purpose of abstraction is data hiding.

What is Encapsulation?

Encapsulation is one of the concepts in OOPs concepts; it is the process that binds together the data and code into a single unit and keeps both from being safe from outside interference and misuse.