Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is this inheritance?

 
Arthur Blair
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21955
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Arthur Blair
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 15753
74
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes again...
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!