0

What is the difference between null and empty?

Is empty keyword? Please define empty!

7th Mar 2019, 6:47 AM
Tarika
Tarika - avatar
1 ответ
+ 1
Memory ------ # Empty string means that the variable has been assigned some memory and nothing is stored in it. It is vacant. # Null means that the variable is not pointing to any address. Methods Call (ie. length) ------------ # The length() of an empty string returns 0 as expected. # The length() of a NULL string returns NullPointerException, as you can't call methods on null variables Check the following code. https://code.sololearn.com/c5AoEDhJmvQe/#java hope it helps!
7th Mar 2019, 7:04 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar