IntConsumer accept example

Description

IntConsumer accept performs this operation on the given argument.

Syntax

accept has the following syntax.


void accept(int value)

Example

The following example shows how to use accept.


import java.util.function.IntConsumer;
/*from   ww w.  j  a  v  a2  s  .co m*/
public class Main {

  public static void main(String[] args) {
    IntConsumer ic = (x)->System.out.println(x);
    
    ic.accept(3);

  }
}

The code above generates the following result.