JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Sealed classes: syntax and usage

    JAVA 25 SELF
    65 level,0 lecture
    In this lecture we cover closed hierarchies in Java 17+: how to declare classes and interfaces with the sealed modifier, specify allowed subclasses via permits, choose the status of subclasses ( final, sealed, non-sealed), and why this strengthens exhaustiveness checking of switch with pattern matching without a default branch. We’ll look at examples with domain models, interaction with interface and record, as well as typical mistakes.
    Open
  • Pattern Matching for instanceof

    JAVA 25 SELF
    65 level,1 lecture
    Let’s break down how, starting with Java 16+, type checking became simpler thanks to pattern matching for instanceof: you check the type and immediately declare a variable of the required type ( if (obj instanceof String s) {...}). We’ll compare it with the “old” approach using explicit casting ( ( String )), discuss variable scope, working with null, inheritance, limitations, and common mistakes. Less boilerplate — better readability and safety (without ClassCastException).
    Open
  • Pattern Matching in switch (Java 17/21+)

    JAVA 25 SELF
    65 level,2 lecture
    In this lecture, we break down the modern switch with pattern matching: case branches with automatic type narrowing, handling null via case null, guard conditions when, exhaustive checks with sealed hierarchies, and nested patterns for record. We show practical examples, nuances, JDK 21+ requirements, and common mistakes.
    Open
  • Record Patterns (Java 21+): syntax, examples

    JAVA 25 SELF
    65 level,3 lecture
    We break down pattern matching for record classes in Java 21+: how to destructure components right in instanceof and switch, use nested patterns and when guard expressions, and build expressive and safe code on top of record classes and sealed hierarchies. Practical examples, limitations, a comparison table, and common mistakes.
    Open
  • Common pitfalls of the new features

    JAVA 25 SELF
    65 level,4 lecture
    A quick guide to the pitfalls of modern language features: the scope of pattern variables in instanceof, behavior with null (including switch branches), nuances of sealed/ permits hierarchies and the requirement for default, limitations of record-patterns, as well as compatibility with JDK and IDE versions. To wrap up — a motivational congratulations on completing the Java 25 course.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy