A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
getting names of child classes
Joined: May 24, 2008
Dec 19, 2011 21:14:31
Given just the parent class name, is there a way to get the list of child classes?
Joined: Oct 14, 2005
Dec 19, 2011 21:36:10
Joined: Jan 03, 2004
Dec 20, 2011 00:49:00
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,
you want the child classes, somebody may be able to suggest a better approach to solving your problem.
Joined: Mar 12, 2011
Dec 20, 2011 12:24:23
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.
It is sorta covered in the
JavaRanch Style Guide
subject: getting names of child classes
Casting - Inheritence
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014