OCP 17 Exam - chapter 7 notes - part 2 (sealed and records)
Sealed classes and interfaces sealed classes allow us to implement “enum” on class level, so it can be used in switch statement: Sealed v = new Chapter7_SealedClasses().new MyClass(); ...
Sealed classes and interfaces sealed classes allow us to implement “enum” on class level, so it can be used in switch statement: Sealed v = new Chapter7_SealedClasses().new MyClass(); ...
Interfaces abstract is implicit in interface - automatically added by compiler public abstract interface AbstractIsImplicitInInterface { // abstract is implicit (added by compiler) ...
my protip: always start reading code from main method Inheritance synonyms of subtype when working with classes: subclass, child class synonyms of supertype when working with c...
access modifiers (public, protected, …) and optional modifiers (final, static) can be in any order, but must be before return type void public method() { } // DOES NOT COMPILE: invalid method d...
be aware that exam want to trick us on concatenation of String and numbers, e.g. prints 66 int five = 5; String six = "6"; System.out.println(1 + five + six); String#substr...
“watch indentation and braces”, e.g. in the following example count is always incremented if (count < 2) System.out.println("Good day"); count++; “pattern matching was introduced to ...
unary = 1 param, binary = 2 params, ternary = 3 params numeric promotions rules: always to larger data type, e.g. short -> int integral type is promoted to floating point if u...
source file must have at most one public type import that specifies class name takes precedence over import with * if there are two classes with the same name e.g. java.util.Date vs. j...
Motivation: The goal is to more effectively measure your performance and impact on a project by categorizing your work in a consistent way. Background: In the past, I used to prefix my commits a...
NOTE: Originally posted on https://blog.cronn.de/en/java/2023/07/14/named-capturing-groups-in-jdk-20.html TL;DR Since JDK 11 there haven't been any significant changes to Regex API. In JDK 20 a ...