How exactly is primitive type stored in java? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

How exactly is primitive type stored in java?

Reference type store memory address of actual object and that's clear. but when I say "int x = 5;" , how does x store 5 in stack memory?

29th Apr 2021, 5:24 AM
Mons Joseph
Mons Joseph - avatar
1 ответ
+ 3
It depends. Normally, in the stack, but if it is a property of an object then it will be stored in the heap.
29th Apr 2021, 6:02 AM
ChaoticDawg
ChaoticDawg - avatar