---
title: "Discussion on \"Modern Java Features: Sealed Classes\" | Hashnode"
description: "Discussion on \"Modern Java Features: Sealed Classes\". Sealing a class or interface restricts the list of subclasses or implementations to a predefined set. For example, consider defining a Shape and restricting subclasses to be only triangles and squares.\npublic class SealedClasses {\n    sealed class Sh..."
url: "https://hashnode.com/posts/modern-java-features-sealed-classes/67f3ed25d5f453ad3728bf2e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Modern Java Features: Sealed Classes](https://codelikeawoman.com/modern-java-features-sealed-classes?utm_source=hashnode&utm_medium=feed)

Sealing a class or interface restricts the list of subclasses or implementations to a predefined set. For example, consider defining a Shape and restricting subclasses to be only triangles and squares. public class SealedClasses { sealed class Sh...

Apr 7, 2025 · 4 min read · codelikeawoman.com  
Read the article

-   [#sealed-class](https://hashnode.com/tag/sealed-class)
-   [#pattern-matching](https://hashnode.com/tag/pattern-matching)
-   [#java](https://hashnode.com/tag/java)
-   [#openclosed-principle](https://hashnode.com/tag/openclosed-principle)

## Written by

[Mirna De Jesus Cambero](https://hashnode.com/@mirnadjc)

@mirnadjc · Dominican Republic

  
[View profile](https://hashnode.com/@mirnadjc)

Coding, Debugging, Practicing

I'm a software engineer with over 15 years of experience. While my background is primarily in backend engineering, my work today spans cloud infrastructure, AI integrations, and the systems that support modern software applications. I started this blog to share what I’ve learned in a simplified, approachable way — and to add value for fellow developers. Though I’m an introvert, I’ve chosen to put myself out there to encourage more women to explore and thrive in tech. I believe that by sharing what we know, we learn twice as much — that’s precisely why I’m here.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
