I am new to JavaScript and have some intermediate knowledge of Java, after a few exercise, I am left with a puzzling question is there a way to apply the concept of anonymous functions in Java? is it even possible? I am well aware of the criticism I might receive for asking this question but I am asking anyway. An example of JavaScript anonymous function is below.
var myResult = (function () {
return arguments[0] + arguments[1];
}) (1,2);
alert(myResult);
javascripttag since this question isn't really about javascript.