This module covers the core concepts of Object-Oriented Programming (OOP) in Java, specifically focusing on Classes, Constructors, Inheritance, and String handling.
- Classes and Objects: Understanding the blueprint vs. the instance, fields, and methods.
- Encapsulation: Using Getters and Setters to protect data.
- Constructors: Initialization, Constructor Chaining, and the
this()andsuper()calls. - POJOs and Records: Traditional Plain Old Java Objects vs. the modern Java Records.
- Inheritance: Extending classes, overriding methods, and the
java.lang.Objecthierarchy. - String Handling: String immutability, formatting (including Text Blocks),
and the
StringBuilderclass.
The project is organized into several subfolders, each focusing on a specific topic:
- classes-constructors/:
Classes: Introduction to class definitions and objects.BankAccount: Practice with fields, methods, and encapsulation.CustomerData: Deep dive into constructors and constructor chaining.Records: Exploring the modern Record type in Java.
- inheritance/:
Inheritance: Basics of class extension (Animal, Dog, Fish).TheObjectClass: Understanding the root of the Java class hierarchy.
- text-strings/:
AllAboutStrings: String methods and manipulation.StringFormatting: Formatting output and using Text Blocks.StringOptions: Efficient string building withStringBuilder.
- challenges/:
InheritanceChallenge: A comprehensive challenge to design a worker hierarchy using inheritance.CylinderCircleInheritance: Inheritance challenge involving Circles and Cylinders.CuboidPoolAreaCalculation: Practice with rectangle and cuboid inheritance for area and volume calculations.