File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Reflection question/doubt" Watch "Java Reflection question/doubt" New topic
Author

Java Reflection question/doubt

Badri Narayanan
Greenhorn

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.
Thanks
-Badri
[ December 10, 2006: Message edited by: Badri Narayanan ]
Jim Yingst
Wanderer
Sheriff

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: http://aspose.com/file-tools
 
subject: Java Reflection question/doubt
 
Similar Threads
Class cast
synchronized method
concat 2 strings using constructor
GC
Reflection problem...new one