1. Description
consumer represents consumption. The interface accepts the general parameter t, calls accept, and performs a series of operations on the parameters, but does not return a value.
2. Example
For Consumer, we need to provide input parameters for consumption.
class Person { String firstName; String lastName; Person() {} Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } }
Java is mainly used in: 1. web development; 2. Android development; 3. client development; 4. web development; 5. enterprise application development ; 6. Java big data development; 7. Game development, etc.
The above is the detailed content of What is the role of java Consumer interface. For more information, please follow other related articles on the PHP Chinese website!