Header Ads

What is the output of the following Java 8 code? (HackerEarth)

interface LangFunction

{

void callMe();

}

class HackerEarth{

public static void main(String args[])

{

String str = "Hacking";

LangFunction Lf = ()-> System.out.println(str+"java"); 

str="ay";

Lf.callMe();

}

}



Output- error: local variables referenced from a lambda expression must be final or effectively final LangFunction Lf = ()-> System.out.println(str+"java");
Powered by Blogger.