---
title: "Discussion on \"When Should You Use a Sealed Class in Kotlin?\" | Hashnode"
description: "Discussion on \"When Should You Use a Sealed Class in Kotlin?\". What a sealed class is, where its subclasses are allowed to live, why when needs no else, and how to choose between a sealed class and a sealed interface."
url: "https://hashnode.com/posts/kotlin-sealed-class/6afa6c3292e557086320faee"
---

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

Discussion

# [When Should You Use a Sealed Class in Kotlin?](https://imayankkumar.hashnode.dev/kotlin-sealed-class?utm_source=hashnode&utm_medium=feed)

What a sealed class is, where its subclasses are allowed to live, why when needs no else, and how to choose between a sealed class and a sealed interface.

5h ago · 9 min read · imayankkumar.hashnode.dev  
Read the article

-   [#kotlin](https://hashnode.com/tag/kotlin)
-   [#android](https://hashnode.com/tag/android)
-   [#androiddev](https://hashnode.com/tag/androiddev)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Mayank Kumar](https://hashnode.com/@imayankkumar)

@imayankkumar · Bengaluru, India

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

Senior Android Engineer | Kotlin, Android Internals, Performance Engineering & AI

I'm Mayank, an Android engineer focused on Kotlin, software architecture, performance engineering, and AI-assisted development. I write about building Android apps with AI, including the experiments that don't work.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
