As the spec states, initialization does not apply to local variables. You
have the relevant text
in your quote of the spec:

"A local variable (�14.3, �14.12) must be explicitly given a value before it
is used, by either initialization (�14.3) or assignment (�15.25), in a way
that can be verified by the compiler using the rules for definite
assignment"

Just add two lines to your example main and it will not compile because a
local variable has
no intial value.

class Point {
 static int npoints;
 int x, y;
 Point root;
}

public class Test {
 public static void main(String[] args) {
  Object localVar;
  System.out.println("localVar=" + localVar);
  System.out.println("npoints=" + Point.npoints);
  Point p = new Point();
  System.out.println("p.x=" + p.x + ", p.y=" + p.y);
  System.out.println("p.root=" + p.root);
 }
}

bash-2.02$ javac Test.java
Test.java:10: Variable localVar may not have been initialized.
  System.out.println("localVar=" + localVar);
                                   ^
1 error
bash-2.02$




***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to