File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Method Invocation Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Method Invocation Problem" Watch "Method Invocation Problem" New topic

Method Invocation Problem

Serkan Demir
Ranch Hand

Joined: Feb 03, 2005
Posts: 61
I have a question on method invocation. Assume that i have a method, named "Factory(int code)".And it executes a pre-defined method according to its parameter. Do you know there is a way for such a method invocation,or in other words,transition from String to method invocation?

public void Factory(int code){
String methodName="getDescription_"+code+"()";
/* How can i invoke "methodName" method at this line?? */


A guy from Turkey<br /><a href="" target="_blank" rel="nofollow"></a>
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Nothing simple:

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Serkan Demir
Ranch Hand

Joined: Feb 03, 2005
Posts: 61
thanks lot.
subject: Method Invocation Problem
It's not a secret anymore!