Newbie question.
Why does the first code segment print out "0" while the second returns errors?
Error free code.
public class test 
{
    public int c;
    public test()
    {
        System.out.println(c); //prints out 0
    }
    public static void main(String args[])
    {
        test t = new test();
        t.printC();
    }
}
Code that doesn't compile
int i;
System.out.println(i); //returns a error in main method as well as other methods.
Compiling 2nd code segment with javac terminal command (OS X)-
test.java:12: error: variable i might not have been initialized
        System.out.println(i);
                           ^
Compiling 2nd code segment with Eclipse-
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    The local variable i may not have been initialized
    at test.test.main(test.java:14)