Why can’t inner classes declare static members?

Basically just an arbitrary decision. there’s no reason it couldn’t be supported, but there is also not really any good reason to support it. just declare the static field in the outer class.

also, that quote may not be entirely correct: i believe you can declare a static serialVersionUID in an inner class.

Update, sounds like this is now possible as of Java 16.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)