|
CHAPTER 6: Names |
|
 Previous |
 Java Language |
 Index |
 Next |
6.1 Declarations
A declaration introduces an entity into a Java program and includes an identifier (S3.8) that can be used in a name to refer to this entity. A declared entity is one of the following:
- A package, declared in a package
declaration (S7.4)
- An imported type, declared in a single-type-import declaration (S7.5.1) or a type-import-on-demand declaration (S7.5.2)
- A class, declared in a class type declaration (S8.1)
- An interface, declared in an interface type declaration (S9.1)
- A member of a reference type (S8.2, S9.2, S10.7), one of the following:
- A field, one of the following:
- A field declared in a class type (S8.3)
- A constant field declared in an interface type (S9.3)
- The field length
, which is implicitly a member of every array type (S10.7)
- A method, one of the following:
- A method (abstract
or otherwise) declared in a class type (S8.4)
- A method (always abstract
) declared in an interface type (S9.4)
- A parameter, one of the following:
- A parameter of a method or constructor of a class (S8.4.1, S8.6.1)
- A parameter of an abstract
method of an interface (S9.4)
- A parameter of an exception handler declared in a catch
clause of a try
statement (S14.18)
- A local variable, one of the following:
- A local variable declared in a block (S14.3)
- A local variable declared in a for
statement (S14.12)
Constructors (S8.6) are also introduced by declarations, but use the name of the class in which they are declared rather than introducing a new name.
 | © 1996 Sun Microsystems, Inc. All rights reserved. |