What’s New in Java 17

What’s New in Java 17

Duration: 3 Days

Description

This comprehensive course examines the powerful features introduced in Java 17, the latest long-term support (LTS) release. Participants will master sealed classes for enhanced type safety, pattern matching for more expressive code, text blocks for readable multi-line strings, and records for concise data modeling. The course covers features introduced across Java 12-17, including switch expressions, helpful NullPointerExceptions, and Stream API enhancements. Through hands-on labs, learners will understand how these modern language features improve code clarity, safety, and maintainability.

Audience

This course is designed for Java developers familiar with Java 11 who want to modernize their skills with the latest LTS release. It is ideal for development teams migrating applications to Java 17, architects designing new systems, and developers who want to leverage contemporary Java language features for cleaner and more robust code.

Objectives

  • Create immutable data carriers using records with minimal boilerplate
  • Implement sealed classes and interfaces to control type hierarchies
  • Apply pattern matching in instanceof and switch for concise conditional logic
  • Use text blocks to improve the readability of multi-line string literals
  • Write enhanced switch expressions as statements and expressions
  • Utilize Stream.toList() and other new API methods for simpler collection handling
  • Debug more effectively using helpful NullPointerException messages
  • Recognize and apply preview and incubator features appropriately

Prerequisites

Participants should be proficient in Java 11 features including lambda expressions, streams, the HTTP Client API, and modern language syntax. Solid understanding of object-oriented programming and Java fundamentals is required. Professional Java development experience is strongly recommended.

Course Outline

Module 1: Java 17 Overview

  • Java 17 as a Long-Term Support Release
  • Evolution from Java 11 to Java 17
  • Feature Timeline — Java 12 through 17
  • Removed and Deprecated Features

Module 2: Records

  • Motivation for Records
  • Defining and Using Records
  • Record Components and Accessors
  • Compact Constructors
  • Records and Inheritance
  • Combining Records with Other Features

Module 3: Sealed Classes and Interfaces

  • Introduction to Sealed Types
  • Declaring Sealed Classes
  • Permitted Subclasses
  • Sealed Interfaces
  • Sealed Classes and Pattern Matching

Module 4: Pattern Matching

  • Pattern Matching for instanceof
  • Type Patterns and Pattern Variables
  • Combining Pattern Matching with Conditional Logic

Module 5: Pattern Matching for switch

  • Traditional switch Limitations
  • Pattern Matching in switch Statements
  • Guarded Patterns
  • Pattern Matching with Records (Preview)

Module 6: Switch Expressions

  • Switch as an Expression
  • Arrow Syntax and Case Labels
  • Yield Statement
  • Exhaustiveness in Switch

Module 7: Text Blocks

  • Multi-Line String Literals
  • Indentation and Formatting
  • Escape Sequences in Text Blocks
  • Practical Applications — SQL, JSON, HTML

Module 8: API and JVM Enhancements

  • Stream.toList() and Collection Factory Methods
  • Helpful NullPointerException Messages
  • New Random Number Generators
  • Enhanced Pseudo-Random Number Generation

Module 9: Other Language and Platform Updates

  • Day Period Support in DateTimeFormatter
  • Unix Domain Socket Channels
  • Strongly Encapsulating JDK Internals
  • Deprecations and Removals