ERROR - "Void methods cannot return a value" while using Consumer and Lambda Expressions in Java 8

Error

Void methods cannot return a value

while using Consumer and Lambda Expressions in Java 8.

Error Type

Compile Time ( Java 8 )

Sample Code

Consumer cnr = p->p>3;

Cause

Consumers represent a function that accepts a single argument and produces no result. This shouldn't return anything from the body of Lambda expression.

Resolution

Specify the a different reference name or different specifier for Lambda expression.

Consumer cnr = p->System.out.println(p);