The behavior you are seeing can also be found in each primitive wrapper
class. The static constant java.lang.Integer.TYPE holds a reference to an
object of type java.lang.Class which is the class of all primitive int
objects - the same applies to other wrappers. BTW, if you call getName() on
that class object you will get the string "int" which is probably what you
saw.

As a coincidence, JSR 202 was approved for further development just today.
Among other things, it adds explicit support for the "Class.class" literal
in the class file format, which will improve access times etc. You can read
the JSR here http://jcp.org/en/jsr/detail?id=202.

Craig.

-----Original Message-----
From: W. Nathaniel Mills, III [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 9:09 AM
To: JDJList
Subject: [jdjlist] Re: Class.class


I found it interesting that int.class returns "int" -- I'd never have
thought to try this as I've never considered native types to be classes,
just arrays of native types...

> -----Original Message-----
> From: Blair Wyman [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 22, 2003 11:39 AM
> To: JDJList
> Subject: [jdjlist] Re: Class.class
> It's a handy construct for uses like Reflection, where arrays 
> of Class are passed to indicate parameter types for reflected 
> methods, as in:
> 
>     Constructor ctor = String.class.getConstructor(
>         new Class[] {byte[].class, int.class}
>     );
> 
> HTH.
> 
> -blair


____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

Reply via email to