'inner classes cannot have static declarations - public static final String[]

I have a problem just in the line 5

public static final String[] CREATIVE_SDK_SCOPES = { "email", "profile", "address" };

Inner classes cannot have static declarations

 public final class Keys {
    public static final String CREATIVE_SDK_CLIENT_ID = "xxxxxxxx";
    public static final String CREATIVE_SDK_CLIENT_SECRET = "xxxxxxxxx";
    public static final String CREATIVE_SDK_REDIRECT_URI = "xxxxxxxxxx";
    public static final String[] CREATIVE_SDK_SCOPES = { "email", "profile", "address" };
  }
  private static final String CREATIVE_SDK_CLIENT_ID = Keys.CREATIVE_SDK_CLIENT_ID;
  private static final String CREATIVE_SDK_CLIENT_SECRET = Keys.CREATIVE_SDK_CLIENT_SECRET;
  private static final String CREATIVE_SDK_REDIRECT_URI = Keys.CREATIVE_SDK_REDIRECT_URI;
  private static final String[] CREATIVE_SDK_SCOPES = Keys.CREATIVE_SDK_SCOPES;

inner classes cannot have static declarations

Can you explain what does it mean and how to resolve it?



Solution 1:[1]

because an inner class is associated with an instance, it cannot define any static members itself.

https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html

You have to use a static nested class instead.

public static final class Keys {

See Why can't inner classes declare static members?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1