Java Reference
In-Depth Information
I
int
J
long
class or interface
L classname ;
S
short
Z
boolean
For example, an array of int is named [I , while an array of Object is
named [Ljava.lang.Object; (note the trailing semicolon). A multidimen-
sional array is just an array whose component type is an array, so, for
example, a type declared as int[][] is named [[I an array whose com-
ponent type is named [I . These internal format names can be passed to
forName to obtain the class objects for array types, and it is this name
that getName returns for array types.
For primitive types and void, the simple name, canonical name, and bin-
ary name are all the samethe keyword that presents that type, such as
int , float , or void and all the name methods return the same name. For
these types, Class objects cannot be obtained from forName . You must
use the class literals, such as int.class , or the TYPE field of the appro-
priate wrapper class, such as Void.TYPE . If a name representing one of
these types is used with forName , it is assumed to be a user-defined class
or interface and is unlikely to be found.
 
Search WWH ::




Custom Search