Is it possible to store a method into a variable? Something like
public void store() { SomeClass foo = ; //... String
You can use method reference like -
System.out::println
Which is equivalent to the lambda expression -
x -> System.out.println(x).
Moreover you can user reflection to store method and it will works for the earlier version of java too.
java