What is the best practice for initializing a String method (local) variable to avoid the \"Variable might not have been initialized\" error in Java?
String s=null; or St
It all depends on what you want your program to do. Sometimes it can be useful to see whether a string has been set already or not at which null would be best. Other times you want to prevent NullPointers which makes "" better.
null
""