This kind of confuses me and I'm pretty unsure how this exactly works in Java.
Lets say we have these two variables:
String a = "Hello World";
String b;
It's pretty obvious that a
takes a little space in the stack and points to the value "Hello World" in the heap. But what's the case with b
?
Does it only create that reference in the stack and point nowhere in the heap? I'm assuming its value is currently null
.