---
title: "Discussion on \"Why 1==1 is true but 128==128 is false in Java\" | Hashnode"
description: "Discussion on \"Why 1==1 is true but 128==128 is false in Java\". Uncover why 128 == 128 can be false in Java due to Integer Caching, while 1 == 1 is true."
url: "https://hashnode.com/posts/integer-caching-in-java/66f262b3b7532dddd4eb53a3"
---

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

Discussion

# [Why 1==1 is true but 128==128 is false in Java](https://muku.hashnode.dev/integer-caching-in-java?utm_source=hashnode&utm_medium=feed)

Uncover why 128 == 128 can be false in Java due to Integer Caching, while 1 == 1 is true.

Sep 24, 2024 · 4 min read · muku.hashnode.dev  
Read the article

-   [#integercaching](https://hashnode.com/tag/integercaching)
-   [#java](https://hashnode.com/tag/java)
-   [#interview](https://hashnode.com/tag/interview)
-   [#core-java](https://hashnode.com/tag/core-java)
-   [#java-interview-questions](https://hashnode.com/tag/java-interview-questions)
-   [#memory-management](https://hashnode.com/tag/memory-management)
-   [#java-basics](https://hashnode.com/tag/java-basics)
-   [#java-development](https://hashnode.com/tag/java-development)
-   [#coding-tips](https://hashnode.com/tag/coding-tips)
-   [#java-programming](https://hashnode.com/tag/java-programming)
-   [#objectorientedprogramming](https://hashnode.com/tag/objectorientedprogramming)

## Written by

[Mukul kumar](https://hashnode.com/@mukul0000)

@mukul0000 · Kolkata

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

Software Engineer

Hey! I am a software Engineer who is skilled in Java backend and has a good understanding of Spring Boot and Quarkus Frameworks

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
