It needs a code block. // This example also includes two nested lambda expressions (the first one is also a closure). (id, defaultPrice) -> {  Lambda expressions are converted to "functional interfaces" (defined as interfaces that contain only one abstract method in addition to one or more default or static methods), as in the following example: public class Calculator {  In this example, a functional interface called codice_41 is declared. Lambda expressions that implement codice_41 are passed to the codice_43 method to be executed. Default methods like codice_44 define methods on functions. Java 8 introduced another mechanism named method reference (the :: operator) to create a lambda on an existing method. A method reference doesn't indicate the number or types of arguments because those are extracted from the abstract method of the functional interface. IntBinaryOperator sum = Integer::sum;  In the example above, the functional interface codice_45 declares an abstract method codice_46, so the compiler looks for a method codice_47 in the class codice_48. Java 8 lambdas have the following limitations:  JavaScript/ECMAScript supports anonymous functions.  alert((function(x){ })(10)); ES6 supports "arrow function" syntax, where a => symbol separates the anonymous function's parameter list from the body:  alert((x => x * x)(10)); This construct is often used in Bookmarklets. For example, to change the title of the current document (visible in its window's title bar) to its URL, the following bookmarklet may seem to work.  javascript:document.title=location.href;  However, as the assignment statement returns a value (the URL itself), many browsers actually create a new page to display this value. Instead, an anonymous function, that does not return a value, can be used:  javascript:(function(){document.title=location.href;})(); The function statement in the first (outer) pair of parentheses declares an anonymous function, which is then executed when used with the last pair of parentheses. This is almost equivalent to the following, which populates the environment with codice_49 unlike an anonymous function.  javascript:var f = function(){document.title=location.href;}; f(); Use void() to avoid new pages for arbitrary anonymous functions:  javascript:void(function(){return document.title=location.href;}());  or just:  javascript:void(document.title=location.href); JavaScript has syntactic subtleties for the semantics of defining, invoking and evaluating anonymous functions.