• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic