I have a big problem that I really don't know the solution to, I can't seem to figure it out after hours of looking and trying stuff around...
I want to have an array which has methods inside, and I want to call them later on with their respective index, the test code looks like this:
package methods;
public class Methods {
public static void main(String[] args) {
Methods[] methodsArray = {print_something(), something_else()};
methodsArray[0];
}
public static void print_something() {
System.out.println("Hiya!");
}
public static void something_else() {
System.out.println("Something else!");
}
}
Runnable), but you don't necessarily need a lambda expression: a method reference works as well.