class Example
<N
extends Number, D
extends Double
> { N nullAsNumber() { return null; }
D nullAsDouble() { return null; }
public static void main
(String[] args
) { Example
<Double, Double
> e
= new Example
<>();
try {
Double a
= false ? 0.0 : e.
nullAsNumber(); System.
out.
printf("a == %f%n", a
); Double b
= false ? 0.0 : e.
nullAsDouble(); System.
out.
printf("b == %f%n", b
);
}
}
}
Y2xhc3MgRXhhbXBsZTxOIGV4dGVuZHMgTnVtYmVyLCBEIGV4dGVuZHMgRG91YmxlPiB7CiAgICBOIG51bGxBc051bWJlcigpIHsgcmV0dXJuIG51bGw7IH0KICAgIEQgbnVsbEFzRG91YmxlKCkgeyByZXR1cm4gbnVsbDsgfQogICAgCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKFN5c3RlbS5nZXRQcm9wZXJ0eSgiamF2YS52ZXJzaW9uIikpOwogICAgICAgIEV4YW1wbGU8RG91YmxlLCBEb3VibGU+IGUgPSBuZXcgRXhhbXBsZTw+KCk7CiAgICAgICAgCiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgRG91YmxlIGEgPSBmYWxzZSA/IDAuMCA6IGUubnVsbEFzTnVtYmVyKCk7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCJhID09ICVmJW4iLCBhKTsKICAgICAgICAgICAgRG91YmxlIGIgPSBmYWxzZSA/IDAuMCA6IGUubnVsbEFzRG91YmxlKCk7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCJiID09ICVmJW4iLCBiKTsKICAgICAgICAgICAgCiAgICAgICAgfSBjYXRjaCAoTnVsbFBvaW50ZXJFeGNlcHRpb24geCkgewogICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oeCk7CiAgICAgICAgfQogICAgfQp9