> java field declarations in interface ~ Online tutorial

java field declarations in interface

Field (Constant) Declarations
The materials of action are variable,
but the use we make of them should be constant.

ConstantDeclaration:
ConstantModifiersopt Type VariableDeclarators ;
ConstantModifiers:
ConstantModifier
ConstantModifier ConstantModifers
ConstantModifier:
one of
Annotation
public
static
final
  • Every field declaration in the body of an interface is implicitly public,
    static, and final. It is permitted to redundantly specify any or all of these modifiers
    for such fields.
  • If an annotation a on a fielddeclaration corresponds to an annotation type T,
    and T has a (meta-)annotation m that corresponds to annotation.Target, then m
    must have an element whose value is annotation.ElementType.FIELD, or a
    compile-time error occurs. Annotation modifiers are described further in
    If the interface declares a field with a certain name, then the declaration of
    that field is said to hide any and all accessible declarations of fields with the same
    name in superinterfaces of the interface.
  • It is a compile-time error for the body of an interface
    declaration to declare
    two fields with the same name.
  • It is possible for an interface to inherit more than one field with the same
    name .
  • Such a situation does not in itself cause a compile-time error.
  • However, any attempt within the body of the interface to refer to either field by its
  • simple name will result in a compile-time error, because such a reference is ambiguous.

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: