0
What is the difference between null and empty?
Is empty keyword? Please define empty!
1 Answer
+ 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!