変数に属するメソッドの参照が破棄されるとどうなりますか?
public class Hey{
public double bar;
public Hey(){
bar = 2.0d;
}
public double square(double num){
return Math.pow(num , bar);
}
}
Function<Double, Double> square;
whatsGonnaHappen: {
Hey hey = new Hey();
square = hey::square;
}//is hey still kept around because its method is being referenced?
double ans = square.apply(23d);