public class Test{
static String s1;
static Integer i1;
public static void main (String args [])
{
System.out.println(s1);
System.out.println(i1);
}
} Since s1 and i1 are member variables they are automatically initialised to default value(null)
It is as good as writing
static String s1=null;
static Integer i1=null;
But if u have something like this:
public class Test{
public static void main (String args [])
{
static String s1;
static Integer i1;
System.out.println(s1);
System.out.println(i1);
}
}
It will not compile,because now they are in a method body they will not be initialized to default value(null)
Hope it helps