---
title: "Discussion on \"Inner vs Nested Class in Kotlin: What Is the Difference?\" | Hashnode"
description: "Discussion on \"Inner vs Nested Class in Kotlin: What Is the Difference?\". A nested class has no link to its outer object. An inner class keeps one. What the compiler generates for each, and how that hidden link can leak an Activity."
url: "https://hashnode.com/posts/kotlin-inner-vs-nested-class/6afcaab32c3818378a9df672"
---

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

Discussion

# [Inner vs Nested Class in Kotlin: What Is the Difference?](https://imayankkumar.hashnode.dev/kotlin-inner-vs-nested-class?utm_source=hashnode&utm_medium=feed)

A nested class has no link to its outer object. An inner class keeps one. What the compiler generates for each, and how that hidden link can leak an Activity.

1d ago · 8 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.
