Invoking method with name pattern

I need to call some functions generated by some libs. I will need to call fucntion1, function2, ..., function10 one by one. Instead of writing them all out on the code, is there any clever way to code it?

Answer:1

You could use reflection.

Some some = new Some();

for (int i = 1; i <= 10; i++) {
    some.getClass().getMethod("function" + i).invoke(some);
}
Answer:2

this is the snippet that produces an error saying : ')' expected ';' expected not a statement cannot find symbol symbol : variable ActionEvent The snippet : private void jMenuItem5ActionPerformed(...

I know that a child cannot reduce the visibility of a non-static method and I understand why it is so. I've read however that "static method can be hidden through its redeclaration". I however do not ...

I am using swing to build a GUI with 4 JPanels inside a JPanel using the BorderLayout manager: A row of labels A column of JButtons A display area (it is a class that extends JPanel and has nothing ...

Possible Duplicate: Update more than one row atomically I have a set of data-chunks stored in a noSQL database. To update the data I need to: fetch (get) update data write (put) (no direct ...