I tried to declare a class as shown below
class Outer{
private final class Inner{
public static final String s1 = new String(\"123\");
public
Read Java Language Specification, 3rd ed, §8.1.3.
An inner class is a nested class that is not explicitly or implicitly declared static. Inner classes may not declare static initializers (§8.7) or member interfaces.
This is why you cannot declare new public static final String s1 = new String("123");
.
Inner classes may not declare static members, unless they are compile-time constant fields (§15.28).
This explains why you can do public static final String s2 = "123";
A static nested class can have static members.