|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Method name as a variable.
Posted by Tarakeswar on August 28, 2001 at 6:58 AM
does anyone know how i can call a method whose name is determined dynamically? for instance, if i have two methods: public void method0(){ } public void method1(){ } and i want to call the method based on the value of x (without using an if statement), can i do so? in other words, instead of calling method0() or method1(), can i call, so to speak, methodx(), which, if x is 0, will call method0() and, if x is 1, will call method1()?
Replies:
- Yes you can... N�l S. Karkera August 29, 2001 at 2:20 PM
(0)
- reply aasc50 August 28, 2001 at 9:11 PM
(0)
- reply aasc50 August 28, 2001 at 9:05 PM
(0)
|