In PHP we can call methods dynamically like this:
class Klass{
function method1(){ ... }
function method2(){ ... }
function method3(){ ... }
function methodN(){ ... }
}
And I can call dynamically like this:
Klass k = new Klass();
$i = 0;
while($i <= N){
k->method{$i}();
}
//or
$i = 'anything';
k->$i();
Can anybody please tell me how can I achieve this in JAVA?