Structure of a Java Source File
The structure every Java source file must follow.
Constructors vs Initializers in Java
Constructors are called when creating an instance of a class, whereas initializers are called regardless of the constructor.
Record Patterns in Java
Pattern matching specific for record types.
Pattern Matching Using Switch in Java
Pattern matching is both supported in switch statements and switch expressions.
Inheritance vs Composition
Inheritance is where a class inherits from another class, whereas composition is a class instance inside another class.
Pattern Matching Using the instanceof Operator in Java
Pattern matching using instanceof allows you to define pattern variables, simplifies code, and avoids ClassCastExceptions.
Anonymous Classes in Java
Anonymous classes are unnamed implementations of a class.
Sealed Classes in Java
Sealed classes and interfaces allow you to restrict who can extend or implement them.
Exceptions vs Errors in Java
Exceptions are programming errors or recoverable errors, whereas an Error is something that isn't recoverable.
Exception Handling in Java
Exceptions in code are either thrown or caught and handled.