+ 1
Does string in java terminate with NULL and does it occupy any space? What will be length of the string "HELLO" ?
Questions on string
2 Respuestas
+ 2
strings are refrence type that means string variables store refrences to string objects in the heap...if you assign null to a string variable, string object that it refered become condidate for terminating(collecting) by GC(garbage collector)..you can think strings as array of characters thus HELLO length = 5...(sorry,english is not my first language)...
+ 1
stirng in java is an object, but still in deep level it dose use '\0' char to teriminate the string, and yes it dose take space... but in most cases you dont need to worry about that...