NAMES
The Members of a Package
6.4.1
The example:
import java.util.*;
class Vector {
int val[] = { 1 , 2 };
}
class Test {
public static void main(String[] args) {
Vector v = new Vector();
System.out.println(v.val[0]);
}
}
compiles and prints:
1
using the class
Vector
declared here in preference to class
java.util.Vector
that might be imported on demand.
6.4 Members and Inheritance
Packages and reference types have
members
. The members of a package ( 7) are
subpackages ( 7.1) and all the class ( 8) and interface ( 9) types declared in all
the compilation units ( 7.3) of the package. The members of a reference type
( 4.3) are fields ( 8.3, 9.3, 10.7) and methods ( 8.4, 9.4). Members are either
declared in the type, or
inherited
because they are accessible members of a super
class or superinterface which are neither hidden nor overridden ( 8.4.6).
This section provides an overview of the members of packages and reference
types here, as background for the discussion of qualified names and the determi
nation of the meaning of names. For a complete description of membership, see
7.1, 8.2, 9.2, and 10.7.
6.4.1 The Members of a Package
A member of a package ( 7) is a subpackage ( 7.1), or a class ( 8) or interface
( 9) type declared in a compilation unit ( 7.3) of the package.
In general, the subpackages of a package are determined by the host system
( 7.2). However, the standard package
java
always includes the subpackages
lang
,
util
,
io
, and
net
and may include other subpackages. No two distinct
members of the same package may have the same simple name ( 7.1), but mem
bers of different packages may have the same simple name. For example, it is pos
sible to declare a package:
85
footer
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