This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes getting names of child classes 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 » Java in General
Bookmark "getting names of child classes" Watch "getting names of child classes" New topic

getting names of child classes

D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
Hi All,

Given just the parent class name, is there a way to get the list of child classes?

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Not in the general case, no. In some limited contexts you could, but unless you're writing an IDE or profiler or something, it's not likely you actually need to do so.

If you can explain what you're trying to accomplish, why you want the child classes, somebody may be able to suggest a better approach to solving your problem.
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
In Eclipse Package Explorer, select the Java file and press F4 or right-click and select Open Type Hierarchy.

If you have the source open in the editor you can also highlight the class name and press F4.
I agree. Here's the link:
subject: getting names of child classes
Similar Threads
OO Design
subclass methods
Protected(Access specifier)
Casting - Inheritence