How many changes do you need to make in order for this code to compile?
public class Main { private static double getNumber() { return .007; } /*from w w w. ja va2 s.co m*/ public static void math() { Supplier<double> s = Main:getNumber; double d = s.get(); System.out.println(d); } }
C.
First, a method reference uses two colons, so it should be Main::getNumber()
.
Second, you can't use generics with a primitive, so it should be Supplier<Double>.
The rest of the code is correct, so Option C is correct.