This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Reflection question/doubt  RSS feed

 
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 ]
 
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]).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!