Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Reflection question/doubt  RSS feed

 
Badri Narayanan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can use Class.forName(), the same way you did for the first class you got (from args[0]).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!