Thanks, didn't know about TYPE either... My interest was that a Class
actually exists to describe a native type int, even though native types are
not Classes per se and can't be instantiated... (e.g., obviously, int i =
new int(2); fails and actually thinks an int[] is attempting to be created
from the error message).
class test {
public static void main(String[] args) {
System.out.println("int:"+int.class.getName());
System.out.println("Integer:"+Integer.class.getName());
System.out.println("Integer.TYPE:"+Integer.TYPE.getName());
}
}
Outputs:
int:int
Integer:java.lang.Integer
Integer.TYPE:int
Regards, Nat
> -----Original Message-----
> From: Craig Dickson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 22, 2003 12:57 PM
> To: JDJList
> Subject: [jdjlist] Re: Class.class
>
>
> 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.
>
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________