An anonymous inner class can extend one subclass or implement one
interface. Unlike non-anonymous classes (inner or otherwise), an anonymous
inner class cannot do both. In other words, it cannot both extend a class and
implement an interface, nor can it implement more than one interface.
Chapter 8 p.658 K&B SCJP for Java 5
JDBCSupport - An easy to use, light-weight JDBC framework -
Harry Henriques wrote:Thanks for your reply, Sebastian. But the code below compiles and runs just fine. I instantiate an implementation of interface Range and an implementation of interface Grassland. The output is below in red.
[SCJP 6.0]
The extended class can implement lots of interfaces itself, or implemented interface can extend from lots of other interfaces. Just like it shows in your code.
SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Ninad Kulkarni wrote:As per my knowledge anonymous inner class implement only one interface.
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|