I’m trying to understand the space classes take up in memory in the heap when initialized, but I can’t find definitive information on this, so my question is given these 3 examples, what would be the order of size taken up by each class?
I know every int takes up a space of 4 bytes, but does not declaring it as a val or var alter this as in class C? Does having a getter method also alter it as in class A?
class A (
val x: Int = 999,
val y: Int get() = 999,
var z: Int = -1
)
class B (
val x: Int = 0,
val y: Int = 999,
val z: Int = -1
)
class C (
x: Int = 999,
y: Int = 999,
z: Int = 999
)