An open API service indexing awesome lists of open source software.

https://github.com/vimalyad/object_oriented_programming

A comprehensive guide and code repository demonstrating the fundamental concepts of Object-Oriented Programming in Java through practical examples and detailed implementations.
https://github.com/vimalyad/object_oriented_programming

Last synced: 15 days ago
JSON representation

A comprehensive guide and code repository demonstrating the fundamental concepts of Object-Oriented Programming in Java through practical examples and detailed implementations.

Awesome Lists containing this project

README

          

# Object-Oriented Programming (OOP) in Java

This repository serves as a comprehensive guide and code resource for understanding the fundamental concepts of
Object-Oriented Programming (OOP) in Java. Each concept is demonstrated with clear, simple code examples to help
solidify your understanding.

---

## Table of Contents

- [Introduction to OOP](#introduction-to-oop)
- [Classes and Objects](#classes-and-objects)
- [Pillars of OOP](#pillars-of-oop)
- [Encapsulation](#encapsulation)
- [Inheritance](#inheritance)
- [Polymorphism](#polymorphism)
- [Abstraction](#abstraction)
- [Other Key Concepts](#other-key-concepts)
- [Interfaces](#interfaces)
- [Packages](#packages)
- [Access Modifiers](#access-modifiers)
- [Generics](#generics)

---

## Introduction to OOP

Object-Oriented Programming is a programming paradigm based on the concept of "objects," which can contain data and
code. This approach aims to model real-world entities and their interactions, making code more organized, reusable, and
easier to maintain.

---

## Classes and Objects

A **class** is a blueprint for creating objects. It defines the state (fields) and behavior (methods) that an object
will have. An **object** is an instance of a class, created from that blueprint.

- **Code Example** :
[https://github.com/yamiSukehiro2907/OOPS/tree/master/Introduction](https://github.com/yamiSukehiro2907/OOPS/tree/master/Introduction/src)

---

## Pillars of OOP

### Encapsulation

**Encapsulation** is the practice of bundling data (fields) and the methods that operate on that data into a single
unit (a class). It also involves restricting direct access to some of an object's components, which is typically
achieved using **access modifiers** like `private`.

- **Code Example**:
[https://github.com/yamiSukehiro2907/OOPS/tree/master/Encapsulation](https://github.com/yamiSukehiro2907/OOPS/tree/master/Encapsulation/src)

### Inheritance

**Inheritance** is a mechanism where a new class (`subclass`) inherits fields and methods from an existing class (
`superclass`). This allows for code reusability and establishing a clear hierarchy between classes.

- **Code Example**:
[https://github.com/yamiSukehiro2907/OOPS/tree/master/Inheritance](https://github.com/yamiSukehiro2907/OOPS/tree/master/Inheritance/src)

### Polymorphism

**Polymorphism** means "many forms." It allows objects of different classes to be treated as objects of a common
superclass. The most common form is **Dynamic Method Dispatch**, where the specific method to be executed is determined
at runtime.

- **Code Example**:
[https://github.com/yamiSukehiro2907/OOPS/tree/master/PolyMorphism](https://github.com/yamiSukehiro2907/OOPS/tree/master/PolyMorphism/src)

### Abstraction

**Abstraction** involves hiding complex implementation details and showing only the essential features of an object.
This is typically achieved using **abstract classes** and **interfaces**.

- **Code Example**:
[https://github.com/yamiSukehiro2907/OOPS/tree/master/Abstraction](https://github.com/yamiSukehiro2907/OOPS/tree/master/Abstraction/src)

---

## Other Key Concepts

### Interfaces

An **interface** is a blueprint of a class. It can contain method signatures but no method bodies. A class can implement
multiple interfaces, providing a form of multiple inheritance.

- **Code Example**: `[Coming soon...]`

### Packages

**Packages** are a way of organizing related classes and interfaces. They help to prevent naming conflicts and control
access to classes.

- **Code Example**:
[https://github.com/yamiSukehiro2907/OOPS/tree/master/Packages](https://github.com/yamiSukehiro2907/OOPS/tree/master/Packages/src)

### Access Modifiers

**Access modifiers** control the visibility and accessibility of classes, fields, constructors, and methods. The four
types are `public`, `protected`, `default` (no keyword), and `private`.

- **Code Example**:
[https://github.com/yamiSukehiro2907/OOPS/tree/master/Access%20Control](https://github.com/yamiSukehiro2907/OOPS/tree/master/Access%20Control/src)

### Generics

**Generics** allow you to create classes, interfaces, and methods that operate on different types of data without type
safety issues. They help to provide stronger type checks at compile time.

- **Code Example**: `[Coming soon...]`