Javatpoint Logo
Javatpoint Logo

Java BiConsumer Interface

BiConsumer Interface accepts two input arguments and does not return any result. This is the two-arity specialization of Consumer interface. It provides a functional method accept(Object, Object) to perform custom operations.

Java BiConsumer Interface Methods

Method Description
void accept(T t, U u) It performs this operation on the given arguments.
default BiConsumer<T,U> andThen(BiConsumer<? super T,? super U> after) It returns a composed BiConsumer that performs, in sequence, this operation followed by the after operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the after operation will not be performed.

Java BiConsumer Interface Example 1

Output:

Rama 20
Shyam 25
Peter 28

Java BiConsumer Interface Example 2

Output:

----------Student records-----------
115 Tom
100 Mohan
120 Danish
110 Sujeet





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA