---
title: "Discussion on \"Kotlin: lateinit vs lazy\" | Hashnode"
description: "Discussion on \"Kotlin: lateinit vs lazy\". Differences between Kotlin's lateinit and lazy."
url: "https://hashnode.com/posts/kotlin-lateinit-vs-lazy/64a50c2057c9282906b40238"
---

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

Discussion

# [Kotlin: lateinit vs lazy](https://rommansabbir.com/kotlin-lateinit-vs-lazy?utm_source=hashnode&utm_medium=feed)

Differences between Kotlin's lateinit and lazy.

Jul 5, 2023 · 5 min read · rommansabbir.com  
Updated Dec 14, 2023  
Read the article

-   [#android](https://hashnode.com/tag/android)
-   [#kotlin](https://hashnode.com/tag/kotlin)
-   [#android-app-development](https://hashnode.com/tag/android-app-development)
-   [#kotlin-nullsafety](https://hashnode.com/tag/kotlin-nullsafety)
-   [#clean-code](https://hashnode.com/tag/clean-code)

## Written by

[Romman Sabbir](https://hashnode.com/@rommansabbir)

@rommansabbir · Dhaka, Bangladesh

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

An engineer with extensive Android experience | Kotlin, Spring Boot, Compose, Swift, Swift UI

Senior Android Engineer from Bangladesh. Love to contribute in Open-Source. Indie Music Producer.

## Responses 1

Markdown supported · ⌘↵ to post

[Kaouther Mefteh](https://hashnode.com/@KaoutherM)

[Dec 14, 2023](https://hashnode.com/posts/kotlin-lateinit-vs-lazy/64a50c2057c9282906b40238/comment/657ab9144250ac781a30f3fd)

Hi there, thanks a lot this is very useful :) small note is lateinit does not work with primitive types, means this line lateinit var age: Int is not correct. on the other hand primitive types are used with lazy delegates

[Romman Sabbir](https://hashnode.com/@rommansabbir)

[Dec 14, 2023](https://hashnode.com/posts/kotlin-lateinit-vs-lazy/64a50c2057c9282906b40238/comment/657ab9144250ac781a30f3fd#reply-657b1c6976f2f92c7f5a7e5d)

Thanks for the correction. Yes, you are right. lateinit cannot be used with primitive types. lateinit is designed for non-nullable types, and since primitive types like Int cannot be null, using lateinit with them is not allowed.
