public class Main {
public static void main(String... args) {
//
StudentCreator<Student> personFactory = Student::new;
Student person = personFactory.create("First", "Last");
}
}
interface StudentCreator<P extends Student> {
P create(String firstName, String lastName);
}
class Student {
String firstName;
String lastName;
Student() {}
Student(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
}