[676] in java-interest
Re: Java compiler is trying too hard for me
daemon@ATHENA.MIT.EDU (Jason Weiler)
Wed Jul 12 21:32:46 1995
Date: Wed, 12 Jul 1995 17:19:49 -0700
From: weilerj@std.teradyne.com (Jason Weiler)
To: dan.evans@peri.com, li@deming.Jpl.Nasa.Gov
Cc: java-interest@java.sun.com
> Dan,
>
> OK, I agree with you its a good idea to initialize variables. From now on,
> I'll try to init all local variable to make "javac" happy. However, this
> problem is a bit more complicated, e.g., the "javac" will let the following
> code thru:
>
> class smartjavac {
> int x; // x is now moved to outside....
> public void init() {
> for (int i=0; i<3; i++) {
> if (i == 0) x = i;
> else if (i == 1) x = i;
> else x = i;
> }
> System.out.println("ValueOfX is " + x );
> }
> }
>
> Looks like "javac" only check this condition for variables defined locally
> within the current function scope.
Presumably, a constructor would init the variable in this case.
-Jason Weiler
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com