Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Class[] question

  Asked By: Qadriyah    Date: Feb 28    Category: Java    Views: 750
  

I am trying to invoke a method dynamically. I need a Class[] of args to get
the Method object with a specific signature. My question is if one of my
arguments is a native data type and I don't know this in advance how do I:

A. determine the data type of a passed argument
and
B. create a Class object for a native data type.

Class[] classArray = new Class[args.length];
for (int i = 0; i < args.length; i++) {
classArray[i] = args[i].getClass();
}

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Landra Schmidt     Answered On: Feb 28

I meant to say primitive instead of native.

 
Answer #2    Answered By: Alexander Bouchard     Answered On: Feb 28

this is a PHP construct and I am trying to convert it to Java.....

foreach($this->expressions as $expression)

 
Didn't find what you were looking for? Find more on Class[] question Or get search suggestion and latest updates.




Tagged: