Java Reference
In-Depth Information
binary name of a top-level class or interface is its canonical name. For
nested types there is a special naming convention, as you learned in
" Implementation of Nested Types " on page 149 . Static nested types
and inner classes (excluding local and anonymous inner classes) have
a binary name that consists of the binary name of their immediately
enclosing type, followed by $ and the simple name of the nested or
inner type. For example, the binary name of the Entry interface is
java.util.Map$Entry . For local inner classes, the binary name is the bin-
ary name of the enclosing class, followed by $ , then a number, and then
its simple name. For an anonymous inner class, the binary name is the
binary name of the enclosing class, followed by $ and a number. [3] You
get the binary name of a type from the Class method getName . This bin-
ary name is what forName expects as a class or interface name.
[3] Since the binary name is not uniquely specified for local and anonymous classes, you cannot use
reflection to instantiate these classes in a portable way. Fortunately, it is exceedingly rare that you
would want to.
For their names, array types have a special notation, known as internal
format because it is the format used inside the virtual machine. But for
some reason this notation is not considered a binary name. This nota-
tion consists of a code representing the component type of the array,
preceded by the character [ . The component types are encoded as fol-
lows:
B
byte
C
char
D
double
F
float
 
 
Search WWH ::




Custom Search