include::../description.adoc[]

== Noncompliant Code Example

----
public class Myclass {
  public final int THRESHOLD = 3;   
}
----

== Compliant Solution

----
public class Myclass {
  public static final int THRESHOLD = 3;    // Compliant
}
----

== Exceptions

No issues are reported on final fields of inner classes whose type is not a primitive or a String. Indeed according to the Java specification:

____
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. Inner classes may not declare static members, unless they are compile-time constant fields (§15.28).

____

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
