Possible Duplicate:
Java modifiers syntax and format
Is it private static final
or private final static
. I do understand that both of them work, but would like to know the order in which the spec declares it.
A qualifier is an annotation that you apply to a bean. A qualifier type is a Java annotation defined as @Target({METHOD, FIELD, PARAMETER, TYPE}) and @Retention(RUNTIME). For example, you could declare an @Informal qualifier type and apply it to another class that extends the Greeting class.
The @Qualifier("student") uniquely identifies this bean with the "student" string. We have another bean called Manager . This bean is also identified with the @Qualifier("manager") annotation. The CommandLineRunner interface indicates that a bean should run when it is contained within a SpringApplication .
The order of access modifiers doesn't matter. They just have to be present.
For method modifiers, the Java language spec notes, that it is it is customary, though not required, that they appear in the order consistent with that shown above in the production for MethodModifier., which is:
(Annotation) public protected private abstract static final synchronized native strictfp
Addition
recommended order for field modifiers (as of JLS 8.3.1):
(Annotation) public protected private static final transient volatile
recommended order for class modifiers (as of JLS 8.1.1):
(Annotation) public protected private abstract static final strictfp
(Annotation) is not a modifier, it's a placeholder for any annotation. Annotations should be put before any other modifier.
There is no difference, but one of style.
I prefer private static final
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With