This week focused on understanding Object-Oriented Programming (OOP) principles and how Java implements them using classes, objects, inheritance, polymorphism, and abstraction.
Table of Contents
Overview
Topics Covered
Day 1: Object-Oriented Programming Fundamentals
Day 2: Constructors, Instance vs. Class Variables, Access Modifiers
Day 3: this, static, final Keywords and instanceof Operator
Day 4: Object Modeling and Class Diagrams
Day 5: Inheritance
Day 6: Encapsulation, Interface, Abstract Classes, and Polymorphism
Overview
Week 2 was all about diving deeper into Java's core programming paradigm: Object-Oriented Programming. We explored how to design classes and objects, use important keywords, and apply key OOP concepts like inheritance, encapsulation, abstraction, and polymorphism to write modular, reusable, and scalable code.
Topics Covered
What is OOP?
Four main pillars: Abstraction, Encapsulation, Inheritance, and Polymorphism
Real-world analogies of objects and classes
Defining and creating Java classes and objects
What are constructors and their types (default, parameterized)?
this keyword in constructor chaining
Difference between instance and class (static) variables
Access modifiers: public, private, protected, and default
this keyword: reference to current object
static keyword: class-level fields and methods
final keyword: constant variables, final methods and classes
instanceof operator: runtime type checking
Understanding object modeling
How to design a class based on real-world entities
UML class diagrams: structure, attributes, methods, and relationships
Concept of inheritance and its benefits
extends keyword for class inheritance
Superclass and subclass relationship
Method overriding and use of super
Encapsulation: access control and data hiding
Interfaces vs. Abstract Classes
Implementing interfaces and abstract methods
Runtime polymorphism using method overriding\