Object-oriented Java
Classes and objects, inheritance and polymorphism, interfaces, enums and records.
About 5 hours of study
Learning objectives
- Design classes with encapsulation
- Use inheritance and polymorphism
- Model with interfaces, enums and records
Lessons
- 1
Classes and objects Intermediate
Defining classes with fields, constructors and methods, creating objects with new, encapsulation with private fields and getters, this, static members, toString, and object references.
- 2
Inheritance and polymorphism Intermediate
Extending classes with extends and super, overriding methods with @Override, protected members, abstract classes and methods, polymorphism through superclass references, and instanceof with pattern matching.
- 3
Interfaces, enums and records Intermediate
Interfaces as contracts with default methods, implementing several interfaces, Comparable for natural ordering, enums with fields and methods, and records for compact immutable data classes.
Module practice
- Java: A Rectangle classEasy
- Java: A student gradebookMedium
- Java: An immutable Fraction classHard
- Java: Animals that speakEasy
- Java: Shipping costs by parcel typeMedium
- Java: Savings and current accountsHard
- Java: Days of the week as an enumEasy
- Java: Rank players with a Comparable recordMedium
- Java: Shapes behind one interfaceHard