Method reference with the instance

Report a typo

Given the following class with few methods:

class Customer {
    
    String firstName;
    String lastName;
    
    public Customer(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }
} 

Here is one instance of the class:

Customer customer = new Customer("Paul", "Morris");

How will you write a method reference to the method getFirstName using the instance?

Enter the correct answer without a semicolon (;) at the end. Do not use spaces in the result.

Enter a short text
___

Create a free account to access the full topic