Use reflection:
Method method = WhateverYourClassIs.class.getDeclaredMethod("Method" + MyVar);
method.invoke();
More Related Contents:
- Is Java "pass-by-reference" or "pass-by-value"?
- get Index of last Element in list without using lastIndexOf() or any other Java/String- Methods [closed]
- How to fix “Method in class cannot be applied to given types” error?
- When is the finalize() method called in Java?
- How to achieve method chaining in Java?
- What does .class mean in Java?
- Why can’t I declare static methods in an interface?
- “No X11 DISPLAY variable” – what does it mean?
- How to call a method in another class of the same package?
- How to create change listener for variable?
- What does the registerNatives() method do?
- Advantage of set and get methods vs public variable [duplicate]
- java how expensive is a method call
- Return Type of Java Generic Methods
- Return multiple values from a Java method: why no n-tuple objects?
- Changing array in method changes array outside [duplicate]
- What does the return keyword do in a void method in Java?
- Optional Methods in Java Interface
- How does Java store UTF-16 characters in its 16-bit char type?
- Varargs Java Ambiguous Call
- Final arguments in interface methods – what’s the point?
- How can I create a Java method that accepts a variable number of arguments?
- Naming conventions for Java methods that return boolean
- Can methods in java be nested and what is the effect? [closed]
- method in class cannot be applied to given types
- java.lang.NullPointerException with boolean
- Double vs double in java [duplicate]
- Why do variables passed to runnable need to be final?
- Why does this generic java method accept two objects of different type?
- Static method in Java can be accessed using object instance [duplicate]