class TestMe{
public static void main (String args[]){
String s3;
System.out.print(s3);
}
}
why the compiler is giving a error,refernce object has a default value of null,why it is not the output…??
error: variable s3 might not have been initialized
local variables should be initialized before using them, local vars dont get default values in java, thus your
string s3doesn’t get default value null as it is a local variable , thus the compiler error.Fom JLS: