Wednesday, December 13, 2006

Java: For The Record

I'm not a pro at Java, but I do know a thing or two. This semester, I've been told two things by professors that are not true, but I can see how they could be misunderstood or just unknown. So here they are, as of Java 1.5:

  • Java does not initialize integers to 0 automatically.

  • Consider the following:

    int foo;
    System.out.println(foo);

    Not only does this not print 0, it doesn't run. Variable foo needs to be initialized by the programmer.

  • Java has a goto keyword, it is reserved, but it can not be used!

  • Java does not let you use goto, although if you're using eclipse or netBeans, it will be highlighted as a keyword.

    No comments:

    Post a Comment