6
The convention for Java constants says that a constant should be declared with uppercase letters only and words should be separated by underscore (_).
The declaration of a constant is made by the sequence of keywords static
and final
. Ex: public static final String NOME_COMPLETO = "José da Silva";
The class File has its stated constants in camelCase. That is, it does not follow the convention. Several other classes of Oracle itself follow the convention.
Why is this different? Is there any other convention that "overrides" this one? Or has the convention been ignored?
Now I saw, maybe it is because these variables do not have a value already defined before the class is started. Look what the definition of the 3 variables says:
The system-dependent[...]
, i.e., the value is only defined when using the class, for the compiler to identify which is its OS.– user28595
@diegofm Good! Then there is another convention for this case?
– igventurelli
Most likely. The 3 variables are not part of the constant fields with default values.
– user28595
@diegofm Legal. This appears to be the answer. If you are sure, could you please reply?
– igventurelli
I have read somewhere that there is a lot of inconsistency even by accident. I do not know if it is so much the case.
– Maniero