Is it possible through some method to assign a function to a variable in Java, like in PHP or JavaScript?
...Or does this area works on a different way when it comes to Java?
In Java you have Method
and MethodHandles
which can invoke a method via reflection but that is not supported in the language yet.
In Java 8, you will be able to use references to methods.