0

I'm trying to learn Java 8 (moving from C -> Java). I tried:

public class Test {
       public static void main(String[] args){
       int i;
       System.out.println(i);
       }
}

Gives a compiler error saying the variable "i" has not been initialized. I thought that one of the nice things about Java was that it would auto-initialize primitives to a default value.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
Joe
  • 1
  • 1

0 Answers0