Lothar Schulz
Java Sealed Classes vs. Kotlin Sealed Classes #Slideless
#1about 2 minutes
Introducing sealed classes in Java 17
Sealed classes restrict which other classes may extend them, giving developers more control over inheritance hierarchies.
#2about 1 minute
Understanding Kotlin sealed classes as super enums
Kotlin's sealed classes act like enums that can hold state, making them powerful containers for different types of data.
#3about 13 minutes
Refactoring Kotlin code to eliminate nulls with sealed classes
A live coding demo shows how to replace nullable return types with a sealed class to explicitly handle success and failure cases.
#4about 11 minutes
Implementing sealed classes in Java to handle API results
This live coding example demonstrates creating a Java sealed class with final subclasses to manage success and failure states from an API call.
#5about 3 minutes
Using Java sealed interfaces with records for conciseness
Code is refactored from sealed classes to sealed interfaces implemented by records, significantly reducing boilerplate code.
#6about 3 minutes
Applying pattern matching in Java with switch expressions
The if-instanceof chain is replaced with a modern switch expression for exhaustive and more readable pattern matching.
#7about 3 minutes
Conclusion on Java vs Kotlin sealed class parity
Sealed classes in both Java and Kotlin are now functionally on par, so language choice can be based on other factors.
Related jobs
Jobs that call for the skills explored in this talk.
PROSOZ Herten GmbH
Herten, Germany
€47-70K
Junior
Intermediate
Senior
Java
MARKT-PILOT GmbH
Stuttgart, Germany
Remote
€75-90K
Senior
Java
TypeScript
+1
Matching moments
03:31 MIN
The value of progressive enhancement and semantic HTML
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
02:49 MIN
Using AI to overcome challenges in systems programming
AI in the Open and in Browsers - Tarek Ziadé
02:33 MIN
Why you might not need JavaScript for everything
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
05:55 MIN
The security risks of AI-generated code and slopsquatting
Slopquatting, API Keys, Fun with Fonts, Recruiters vs AI and more - The Best of LIVE 2025 - Part 2
14:14 MIN
Scripting presentations and demos in VS Code
Devs vs. Marketers, COBOL and Copilot, Make Live Coding Easy and more - The Best of LIVE 2025 - Part 3
03:58 MIN
Making accessibility tooling actionable and encouraging
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
03:16 MIN
Improving the developer feedback loop with specialized tools
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
08:07 MIN
Exploring modern JavaScript performance and new CSS features
WeAreDevelopers LIVE – AI, Freelancing, Keeping Up with Tech and More
Featured Partners
Related Videos
Route from Java to Kotlin
Christian Woerz
Why Kotlin is the better Java and how you can start using it
Iris Hunkeler
Best of Java 15 and beyond—my favorite features
Michael Inden
Algebraic Data Types + Pattern Matching = Elegant and readable Java code
Balkrishna Rawool
Modern Java: This is not your father's Java anymore
Ron Veen
"What´s New for Developers Moving from Java 11 to 17?"
Daniel Strmečki
Moving from Java to Kotlin
Urs Peter
The Cool Thing about Cool Things in Java 16 & 17 LTS
Mohamed Taman
Related Articles
View all articles.gif?w=240&auto=compress,format)



From learning to earning
Jobs that call for the skills explored in this talk.


Haufe-Lexware GmbH & Co. KG
Freiburg im Breisgau, Germany
Remote
API
Java
Scrum
Kotlin
+4



Lunatech Labs BV
Rotterdam, Netherlands
€3-4K
Intermediate
Java
Scala
Kotlin
Machine Learning
![Java Backend Developer"}}]},{"@context":"https://schema.org/","@type":"JobPosting","@id":"#jobPosting","title":"Remote Kotlin / Java Backend Developer](https://wearedevelopers.imgix.net/public/default-job-listing-cover.png?w=400&ar=3.55&fit=crop&crop=entropy&auto=compress,format)

CodeGuild
Rotterdam, Netherlands
Remote
Senior
Kotlin
Docker
Amazon Web Services (AWS)

Delivery Hero AG
Berlin, Germany
Senior
API
Java
REST
Redis
Kafka
+5

Saltcreek GmbH & Co KG
Siezenheim, Austria
Remote
€53K
Intermediate
Java
Kotlin
Angular
+2