NullPointerException in switch: null selector and case null
A switch on a null String, enum, Integer or sealed type throws NullPointerException, and default won't catch it. Why, how 8 to 25 differ, and the fix.
Core language
Errors & fixes
Apache Kafka
Relational
NoSQL & caching
Errors & fixes
Course · javahandbook.com
Oracle Interview Mastery
200 questions · 19 chapters
View course →Interview courses
A switch on a null String, enum, Integer or sealed type throws NullPointerException, and default won't catch it. Why, how 8 to 25 differ, and the fix.