Wednesday 15 June 2011

Can not understand java statement with new operator -



Can not understand java statement with new operator -

normally, utilize new objclass(args) create new object, how understand one?

import org.jzy3d.plot3d.builder.mapper; ...... mapper mapper = new mapper() { public double f(double x, double y) { homecoming 10 * math.sin(x / 10) * math.cos(y / 20) * x; } };

if mapper class, creates anonymous class extends it. if mapper final class, code won't compile.

if mapper interface, creates anonymous class implements it.

more info:

the java tutorials: anonymous classes

java new-operator

No comments:

Post a Comment