hello all.
I came across some strange thing I couldn't figure out why.
read the following code. it compiles fine with the inner class declaration and creation commented out. but once you take the comments out. it gave you a compiler error that says "final blank variable aaa may not have been initialized" but clearly it's initialized in the User() constructor. can anyone tell me Why?
thanks a lot!!!
------------------------------
class User {
final int aaa;
User() {
aaa = 109;
}
/* take the comments off - won't compile
class User_I { int vv = 0;}
static class User_SI {
static int v = 0;
}
*/
public static void main(
String[] args) {
User u = new User();
/* take the comments off - won't compile
User_I ui = new User().new User_I();
User_SI usi = new User().new User_SI();
User_SI usi2 = new User.User_SI();
*/
}
}
-----------------------
chun