/* Calling multiple methods in java */
for (int i=0;i<N;i++)
{
try {
obj.getClass().getMethod("method"+i).invoke(obj);
}
try {
obj.getClass().getMethod("method"+i).invoke(obj);
}
catch (Exception e)
{
// give up
break;
}
}
ex:
obj.method1()
obj.method2()
obj.method3()
obj.method4()
obj.method5()
// give up
break;
}
}
ex:
obj.method1()
obj.method2()
obj.method3()
obj.method4()
obj.method5()
0 comments:
Post a Comment