my dog learned polymorphism
The moose likes Java in General and the fly likes Java Reflection question/doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Reflection question/doubt" Watch "Java Reflection question/doubt" New topic

Java Reflection question/doubt

Badri Narayanan

Joined: Jun 21, 2004
Posts: 7
all i wanted is to call a
1)class at runtime
2)create an object of it and
3)call any method of it at runtime

See for example i want to call concat method of String class
here is what i did :

But the problem here is
c1[0]=String.class using this iam kinda of declaring the method arguments.Is there any way to create argument types to methods at runtime.
[ December 10, 2006: Message edited by: Badri Narayanan ]
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Yes, you can use Class.forName(), the same way you did for the first class you got (from args[0]).

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Java Reflection question/doubt
It's not a secret anymore!