8.3.1
Field Modifiers
CLASSES
( 6.3) the entire body of the class declaration in which it is declared. More than
one field may be declared in a single field declaration by using more than one
declarator; the
FieldModifiers
 and
Type
 apply to all the declarators in the declara 
tion. Variable declarations involving array types are discussed in  10.2.
It is a compile time error for the body of a class declaration to contain decla 
rations of two fields with the same name. Methods and fields may have the same
name, since they are used in different contexts and are disambiguated by the dif 
ferent lookup procedures ( 6.5).
If the class declares a field with a certain name, then the declaration of that
field is said to
hide
 ( 6.3.1) any and all accessible declarations of fields with the
same name in the superclasses and superinterfaces of the class.
If a field declaration hides the declaration of another field, the two fields need
not have the same type.
A class inherits from its direct superclass and direct superinterfaces all the
fields of the superclass and superinterfaces that are both accessible to code in the
class and not hidden by a declaration in the class.
It is possible for a class to inherit more than one field with the same name
( 8.3.3.3). Such a situation does not in itself cause a compile time error. However,
any attempt within the body of the class to refer to any such field by its simple
name will result in a compile time error, because such a reference is ambiguous.
There might be several paths by which the same field declaration might be
inherited from an interface. In such a situation, the field is considered to be inher 
ited only once, and it may be referred to by its simple name without ambiguity.
A hidden field can be accessed by using a qualified name (if it is
static
) or
by using a field access expression ( 15.10) that contains the keyword
super
 or a
cast to a superclass type. See  15.10.2 for discussion and an example.
8.3.1   Field Modifiers
FieldModifiers:
FieldModifier
FieldModifiers FieldModifier
FieldModifier: one of
public protected private
final static transient volatile
The access modifiers
public
,
protected
, and
private
 are discussed in  6.6. A
compile time error occurs if the same modifier appears more than once in a field
declaration, or if a field declaration has more than one of the access modifiers
public
,
protected
, and
private
. If two or more (distinct) field modifiers
144






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved