Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.function.Consumer;

public class Main {
    public static void main(String... args) {
        Consumer<Person> greeter = (p) -> System.out.println("Hello, " + p.firstName);
        greeter.accept(new Person("First", "Last"));
    }
}

class Person {
    String firstName;
    String lastName;

    Person() {
    }

    Person(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
}