class Scratch {
public void meth1(){
}
public void meth2(){
}
public void meth3(){
}
public void meth4(){
}
public void meth5(){
}
public static void main(String[] args) {
int randomNumber=(int)Math.random()*5;
}
}
Here I have 5 methods, and I want to call them randomly. I am new to OOP but know a bit about C, in that case I would've stored the addresses of the functions(methods) in an array, generate a random number between [0,4] and call the functions using the array in random order. But in Java, I don't know how to get the memory address of a method. How should I do that?