File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Class object for premitive types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Class object for premitive types" Watch "Class object for premitive types" New topic
Author

Class object for premitive types

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
hi:
How can you construct a Class object for a premitive type.
for example (int, double, boolean...)


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
The primitives have corresponding wrapper objects (full Objects) in the java.lang package, along with their class objects, of course.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
hi:
I want to use Class.getConstructor(Class[] paramType) method of the Class class. consider that I want to retrieve this consructor of the ArrayList class: new ArrayList(int initialValue)
I have to supply a Class[] array of the types, in this case it is premitive.
how can I construct a Class Object (not a wrraper object) of the premitive int. Using java.lang.Integer doesn't work.
any suggestions.
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Off the top of my head, I believe it is:

Let me know if that doesn't work and I'll look into it.
Corey


SCJP Tipline, etc.
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Corey :
Thank you so much. it works
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Class object for premitive types
 
Similar Threads
Doubt in Mock Question
Method Invocation..
string question .explanation pls
is java purely object oriented?
how to subtract two strings