This repository showcases fundamental concepts of Object-Oriented Programming (OOP) in Java, covering topics like Inheritance, Encapsulation, Abstraction, Polymorphism, and Interfaces.
Inheritance allows a new class to inherit properties and behavior from an existing class.
Multi-Level Inheritance involves a class derived from another class, which is also derived from another class.
Singleton Inheritance refers to a class inheriting properties from a single parent class.
Java doesn't support Multiple Inheritance directly, but it can be achieved using Interfaces. A class can implement multiple interfaces to inherit behavior from various sources.
Encapsulation is the process of wrapping data (variables) and code (methods) together as a single unit. It involves hiding the internal state of an object and requiring all interaction to be performed through an object's methods.
Abstraction involves hiding the implementation details and exposing only the essential features. Getters and setters are often used to access or modify private variables.
Polymorphism allows objects of different classes to be treated as objects of a common superclass. The @Override annotation is used to modify the behavior of an inherited method.
Interfaces in Java enable multiple inheritance. A class can implement multiple interfaces, inheriting methods from multiple sources.
To get started with this project:
- Clone the repository:
git clone https://github.com/your-username/oop-java-concepts.git
- Navigate to the project directory:
cd oop-java-concepts
- Compile the Java files:
javac src/*.java
- Run the examples:
java src.Main
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a Pull Request.
Please make sure your code follows the project's coding standards.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to explore the code and understand these OOP concepts in Java. Happy coding! 🎉