3

I have two question when learning lambda expression in java.

  1. When we use :: in java. I see in the book using Employee::getSalary but lack of explanation. Do we use :: when we want to implement some function of the class (like getSalary() method in class Employee)?

  2. Function<Employee,double> salary = Employee::getSalary Do Function here like we create method public static double salary(Employee e)?

Thanks.

August
  • 12,410
  • 3
  • 35
  • 51
Tuan Ng
  • 149
  • 1
  • 1
  • 6

0 Answers0