This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class object for premitive types

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
How can you construct a Class object for a premitive type.
for example (int, double, boolean...)
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The primitives have corresponding wrapper objects (full Objects) in the java.lang package, along with their class objects, of course.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Corey :
Thank you so much. it works
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic