In Java, does it cost memory to declare a class level instance variable without initializing it?
For example: Does int i; use any memory if I don\'t initial
In Java, when you declare a class attribute such as String str;, you are declaring a reference to an object, but it is not pointing yet to any object unless you affect a value to it str=value;. But as you may guess, the reference, even without pointing to a memory place, consumes itself some memory.