Hi, sorry again for all the trouble, but I'm trying to get a reflective program to work. It takes a method from a user, and then runs it. My program works except it only works for strings. If they arguments needed for a method require ints or floats or whatnot, I can't run it.

The problem is because
getMethod(String name, Class[] parameterTypes) requires Classes
and
invoke(Object obj, Object[] args) requires objects. And I've tried for hours, but I can't get integers to turn into objects, or get the proper nomenclature (is that the right word?) for the integer class. Can anybody help me?

There are wrapper classes for every primitive type. Use those instead.

From the javadoc (which you DO you, do you?):

"Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary. "

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.