• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reference java methods via string variable  RSS feed

 
icredes
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to call a java method via a string variable
i.e



Thanks

James
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37462
537
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
Yes, but it's on the complicated side. Java contains a library called Reflection. If you know the class and method name, you can create a Method object and then invoke it with the proper parameters.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun has a good tutorial on the subject.

Henry
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!