java - Is the object of an abstract class an anonymous inner class? -
this question has answer here:
- interview: can instantiate abstract class? 15 answers
when create object of abstract class, have interface.
abstractclass abstractclass = new abstractclass() { @override public void abstractmethod() { } };
does mean object of abstractclass
anonymous inner class object?
an object not class object (in context). derived class. in java there difference between classes , objects, compared e.g. prototype based languages (e.g. javascript) difference not exist.
in example create anonymous class, create object of anonymous class , assign variable; in 1 step.
anonymous classes inner classes: http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5 http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3
Comments
Post a Comment