wood burning stoves*
The moose likes Java in General and the fly likes How Set Class for Reflection of Method with Param: char[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How Set Class for Reflection of Method with Param: char[]" Watch "How Set Class for Reflection of Method with Param: char[]" New topic
Author

How Set Class for Reflection of Method with Param: char[]

Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
I know that if a method takes a parameter of type char (the primitive) then I can use Character.TYPE. What do I use for a method that takes a param of type: char[]?
Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
never mind, i just figured it out:
char[].class
Apparently, if it is an array of primitive types, it has a class and is an Object.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yup. For extra confusion, primitive types have a Class object associated with them too - e.g.
Class cl = int.class; //
So do interfaces, even though they're not technically classes either (but they're a heck of a lot closer than primitives are). The class Class should have been called Type instead, but Sun screwed up.


"I'm not back." - Bill Harding, Twister
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How Set Class for Reflection of Method with Param: char[]