Preview:
interface NumFunction
{ long factorial(int n); }

public class BlockLambdaDemo
{
	public static void main(String[] args)
	{
		NumFunction nf = (n) -> {
			            int result = 1;
						for(int i=2; i<=n; i++)
							result *= i;
						return result;
		};
		
		java.util.Scanner scan = new java.util.Scanner(System.in);
		
		System.out.println("Enter an integer: ");
		int n = scan.nextInt();
		System.out.println("The factorial of " + n + " is " + nf.factorial(n));
		
		System.out.println("Enter an integer: ");
		n = scan.nextInt();
		System.out.println("The factorial of " + n + " is " + nf.factorial(n));
		
	}
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter