You can't have static fields/method in a regular inner classes, because, inner classes will work only with instance of outer classes.
So, static can't be there with instances.
But they can have compile time constants, check JLS 8.1.3. You x
, x1
, x2
are not compile time constants, while s1
, s2
, y1
, y2
are compile time constants
Inner classes may not declare static initializers (§8.7) or member interfaces, or a compile-time error occurs.
Inner classes may not declare static members, unless they are constant variables (§4.12.4), or a compile-time error occurs.