![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Hi, I'm a Java newbie currently working through Bruce Eckel's book 'Thinking in Java'. I just got to the chapter on RTTI and I have a question that the book doesn't seem to answer. If you have a base class from which several other classes are derived, e.g. class Shape {} Is there any way of starting with the 'Shape' class, and determining what classes are derived from 'Shape'. I.e. can I do something like Class subclassesofShape[] = Shape.class.getSubClasses(); ...and receive an array containing the classes 'Square', 'Circle' and 'Triangle'? TIA, Replies: |
Sponsored Links
|