*
The moose likes Beginning Java and the fly likes Is this inheritance? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is this inheritance?" Watch "Is this inheritance?" New topic
Author

Is this inheritance?

Arthur Blair
Ranch Hand

Joined: Sep 20, 2005
Posts: 71
I was hoping someone could set me straight on this inheritance / abstract class question. (Courtesy of Bruce Eckels Thinking in Java, again).

I have a private abstract static class Tester as an inner class in my ListPerformance class. As another variable, I have an array of Tester objects which receieve new anonymous classes as parameters.

Since you cannot instantiate an abstract class, when I say new Tester() and implement the abstract method test() in these anonymous classes, does that mean I am extending the Tester class without using the keyword extends?

Thoughts appreciated.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes.
Arthur Blair
Ranch Hand

Joined: Sep 20, 2005
Posts: 71
So would it be correct to say: Each of the anonymous classes in the array is a subclass of the abstract Tester class, but since they are anonymous they don't need an explicit name or the keyword extends?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Yes again...


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this inheritance?
 
Similar Threads
Casting or toString()?
Hashtable vs Hashmap
Basic Round Up question
Needs Explanation
increment ???