<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Jep394 on Devops Monk</title><link>https://devops-monk.com/tags/jep394/</link><description>Recent content in Jep394 on Devops Monk</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 04 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://devops-monk.com/tags/jep394/index.xml" rel="self" type="application/rss+xml"/><item><title>Pattern Matching for instanceof (JEP 394): Smarter Type Checks</title><link>https://devops-monk.com/tutorials/java17/pattern-matching-instanceof/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java17/pattern-matching-instanceof/</guid><description>Finalized in Java 16 (JEP 394). Available in all Java 16+ releases, including Java 17. Previous previews: Java 14 (JEP 305) and Java 15 (JEP 375).
The Problem: The instanceof-Cast Dance Every Java developer has written this pattern:
// Java 11 — check, then cast if (obj instanceof String) { String s = (String) obj; // cast is logically redundant System.out.println(s.toUpperCase()); } The instanceof check already verified the type. The cast on the next line is conceptually redundant — the compiler could infer that obj is a String in the if body.</description></item></channel></rss>