There is a simple difference between the two options,
the first one String str="" will create a reference and initialize the string
literal and the str is ready for use without errors.
the second one String str=null only creates the reference of a string not
initilizing it, so if you need to make use you need to initilize dynamically
Eg
class test {
public static void main(String[] args) {
String str="";
System.out.println("String :"+str); // Will not report exception
}
}
--------------------------------------------------------------------------------\
--
class test {
public static void main(String[] args) {
String str=null;
System.out.println("String :"+str); // Will not report compiler error
}
}