Recursive get inheritance family , but It stop at It's super class.

I make this class for the purpose to getting specified class name's inheritance family.
import java.util.*;
import java.lang.reflect.Field;
// A simple class for getting specify class name's super class family.
// Usage: java GetSuperClass java.util.ArrayList.
public class GetSuperClass {
  //recursive get super class.
  public static void get(String str) {
    Class ref = null;
    try {
      // get Class Objcet.
      ref = Class.forName(str);
    } catch(ClassNotFoundException e) {
      e.printStackTrace(System.err);
      System.exit(0);
      System.out.println(ref);
      System.out.println("field:");
      // get fields
      Field[] field = ref.getDeclaredFields();
      for(int i = 0; i < field.length; i++) {
        System.out.println(field);
//get super class
Class superClass= ref.getSuperclass();
//recursive call get()
if(superClass != null) {
get(superClass.toString());
return;
public static void main(String[] args) {
// must input a class name for getting super class family.
if(args.length != 1) {
System.out.println("incorrect parameters");
System.exit(0);
// call static method to start.
get(args[0]);
Input as into console command prompt.
java GetSuperClass java.util.ArrayListHere is result:
class java.util.ArrayList
field:
private static final long java.util.ArrayList.serialVersionUID
private transient java.lang.Object[] java.util.ArrayList.elementData
private int java.util.ArrayList.size
java.lang.ClassNotFoundException: class java.util.AbstractList
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at GetSuperClass.get(GetSuperClass.java:9)
at GetSuperClass.get(GetSuperClass.java:23)
at GetSuperClass.main(GetSuperClass.java:33)
Question: what's wrong with it?
Thanks for your response.

No need to lokup the super class! You already have it!
import java.util.*;
import java.lang.reflect.Field;
// A simple class for getting specify class name's super class family.
// Usage: java GetSuperClass java.util.ArrayList.
public class GetSuperClass
    public static void get(String str)
        Class ref = null;
        for (ClassLoader cl = GetSuperClass.class.getClassLoader(); cl != null; cl = cl.getParent())
            try
                // get Class Objcet.
                ref = Class.forName(str, false, System.class.getClassLoader());
            catch(ClassNotFoundException e)
                //e.printStackTrace(System.err);
        get(ref);
    private static void get(Class ref)
        System.out.println(ref);
        System.out.println("field:");
        // get fields
        Field[] field = ref.getDeclaredFields();
        for(int i = 0; i < field.length; i++)
            System.out.println(field);
//get super class
Class superClass= ref.getSuperclass();
//recursive call get()
if(superClass != null)
get(superClass);
return;
public static void main(String[] args)
// call static method to start.
get("java.util.ArrayList");

Similar Messages

  • Yesterday got wifi in my home and after nearly 4 months starting learning how my IPad Mini functions.  Later today I tried to get back on but was stopped, with a requirement of a passcode (not a password).  I used the one I knew and was kicked off.

    After having trouble getting back onto my IPAD Mini this afternoon, because I apparently did not have what was required a passcode ??
    I was putting in my previously decided on password.  I had to use my CHROME machine to communicate with Apple, and because there seemed to be some confusion about my identity when I had gone on the Apps sections of my IPAD, and when communicating with Apple on my CHROME machine, I went ahead and changed my password.  Going back to my IPAD to log on, using the new information it again kicked me out - this time saying I couldn't get back on for one hour.
    The only other passcode info I have is because we now have WiFi in our home -- for the first time since I purchased my IPAD at Christmas.  Today was the first time I had been able to get into the system and see some of the functions work - email, maps and then APPS and that's when it went all hinky.
    When will this all get cleared up? 
    What steps do I take now?
    Jazzhappy

    The iPad is looking for a 4 digit passcode that you used to lock the device. Did you set a 4 digit code when you set up your iPad? You need to enter that code in order to unlock it. If you don't know the code, you will have to restore the iPad in order to unlock it.
    Read this for more information.
    iOS: Forgot passcode or device disabled - Apple Support

  • I am getting frequent lock-ups and blue screens during boot up. The lock ups occur during normal use and I cannot click anything or force quit. The cursor shows something is loading, but never stops. I have to use power button. Ideas?

    I am getting frequent lock-ups and blue screens during boot up on my Mac Pro.  The lock- ups occur sometimes during normal use and I cannot click anything or force quit. The cursor shows something is loading, but never stops. I have to use power button.
    I had the Mac Defender malware and I have used apple jack but still having issues.

    I am getting frequent lock-ups and blue screens during boot up on my Mac Pro.  The lock- ups occur sometimes during normal use and I cannot click anything or force quit. The cursor shows something is loading, but never stops. I have to use power button.
    I had the Mac Defender malware and I have used apple jack but still having issues.

  • Problem with iTunes. I have Windows 8 on a new laptop. Installed latest version of iTunes. Can play music in My Library but when I click on Itunes Store I get the message "iTunes has stopped working. A problem caused the program to stop working correctly.

    I have a new laptop with Windows 8 as operating system. Installed latest version of iTunes ontop computer. I can play music in My Library but when I click on iTunes, I get the message " iTunes has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify if a solution is available."
    Anyone know what is the cause and if there is a resolution? Have tried to re-installing iTunes and have also tried restoring laptop to an earlier date.

    iPad not appearing in iTunes
    http://www.apple.com/support/ipad/assistant/itunes/
    iOS: Device not recognized in iTunes for Mac OS X
    http://support.apple.com/kb/TS1591
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    iTunes for Windows: Device Sync Tests
    http://support.apple.com/kb/HT4235
    IOS: Syncing with iTunes
    http://support.apple.com/kb/HT1386
    Apple - Support - iPad - Syncing
    http://www.apple.com/support/ipad/syncing/
    iTunes 10.5 and later: Troubleshooting iTunes Wi-Fi Syncing
    http://support.apple.com/kb/ts4062
    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    iTunes Store: Associating a device or computer to your Apple ID
    http://support.apple.com/kb/ht4627
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
    http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
    Try this first - Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
     Cheers, Tom

  • My contacts on my old Iphone I gave a family member were deleted then synced to icloud.  My current iphone lost all its contacts when it next synced.  I retreived a 6mth old backup to get my contacts, but I want my recent messages back, any help?

    My contacts on my old Iphone I gave a family member were deleted then synced to icloud.  My current iphone lost all its contacts when it next synced.  I retreived a 6mth old backup to get my contacts, but I want my recent messages back, any help?

    The "system" performed as designed. All devices syncing to one iCloud account are kept in common sync. The idea is that all such devices belong to one user. Different users should have different iCloud accounts.  Once your contacts were edited, all devices were updated as well and subsequent backups (from yours and her device) reflected the changed contacts (and any other data that may have been edited like calendars). Your first task is to change your daughter over to a new account before she makes other changes.
    The only way I see for getting back contacts is to restore them from a time machine backup, assuming you also have a Mac included in the account which syncs the contacts. However, I'm not sure whether time machine includes contacts from iCloud along with those that are local, "on my Mac".
    Otherwise the deleted contacts are gone.

  • HT201272 This method is exactly how I'm trying to get my music on my new iPod touch, it starts downloading but then stop and says unable to download at this time. What the **** is going on ?

    This method is exactly how I'm trying to get my music on my new iPod touch, it starts downloading but then stop and says unable to download at this time. What the **** is going on ?

    Try going to Settings>Store and sign out and sign back in.
    It also could be due to an Apple server problem. and yu will just have to wait and try again.

  • How can I get my sound notifications to work?  They used to but have stopped.  I get the banner alerts.  I have checked in Settings - Sound and the volume is at max.  Help please.

    For some reason the sound notifications on my iPad mini have stopped.  I still get banner alerts but that is it.  I have checked Settings - Sounds and the ringer and alerts setting is at max.  I have updated the IOS system.  Not sure what else to do.

    Unlock can be done only by original Carrier. You should get
    this straightened out before leaving Canada. Warranty on your
    iPhone is not international - if you need any repair or replacement,
    you will have to return iPhone to Canada for this to be done.

  • HT201263 i have tried to restore my iPad from my computer, but it stops ones it gets to the stage where it is updating the firmware. Any suggestion to fix this,?

    i have tried to restore my iPad from my computer, but it stops ones it gets to the stage where it is updating the firmware. It will then display " there was an unknown error.....Any suggestion to fix this,?

    Temporarily disable antivirus and firewall on computer.

  • When starting the computer I get the dong but then it stops with three loud beeps as the light in the front flashes in line with the beeps. The beeps repeat till switching off

    When starting the computer I get the dong but then it stops with three loud beeps as the light in the front flashes in line with the beeps. The beeps repeat till switching off

    Check out this Apple support article https://support.apple.com/kb/HT1547

  • Suddenly on sunday while i was working, my macbook Air stopped working, right after that i tried getting it on but nothing came other than a grey screen with a question mark right in the center could you please help me in rectifying the problem. Would th

    Suddenly on Sunday while i was working, my macbook Air which i bought last year in Spetember from Arkansas, Little Rock stopped working, right after that i tried getting it on but nothing came other than a grey screen with a question mark right in the center. Could someone please help me in rectifying the problem. Would thi issue also affect saved data. However, I have handed the notebook to Apple for reapirs and they will revert by Thursday 12/04/2012.

    I just received some horrifying news from Adobe about my production suite.  I just FINALLY learned today that what I've been trying to do for over a week now - CAN'T be done because of compatability issues involving updates of both Adobe & Microsucks Winders!!!  I sincerely hope this is not your problem.  Mine is ALMOST HOPELESS!!  Being in this HOPELESS Obamma economy,,,, leaves NO STIMULUS in which to currently upgrade everything that needs upgraded for me to fully use my INVESTMENT in Adobe Suite - sad, horrible and SICKENING!!!
    I just wanted to post this. And again, I truly hope you find a solution. Good Luck!

  • HT5129 It is past June 30 and I still get the warning, but there is nothing to migrate. How do I stop the warning?

    It is past June 30 and I still get the warning, but there is nothing to migrate. How do I stop the warning?

    Remove any mention of MobileMe in the iPhoto preferences and then in the SystemPreferences
    Regards
    TD

  • I keep getting the message itunes has stopped working I can't even open itunes I have tried uninstalling and installing, starting in safe mode but nothing seems to work. Please can anyone help me

    I have recently bought a new laptop with windows 7 and when i have tried to install and open itunes i keep getting the message 'itunes has stopped working' itunes then shuts down before i can do anything to fix it. This happens every time I try to open itunes. I have tried uninstalling itunes and reinstalling it, starting itunes in safe mode. Nothing seems to work. Please can anyone help.

    If and when I finally manage to open it, as soon as I click on a movie to watch, the message "itunes has stopped working" comes up.
    Try the following user tip with that one:
    iTunes for Windows 10.7.0.21: "iTunes has stopped working" error messages when playing videos, video podcasts, movies and TV shows

  • HT1923 I'm trying to re-install itunes on my laptop & I am getting a message that has stopped the re-install & it says: "Service 'Apple Mobile Device" (Apple Mobile Device) failed to start. Verify that you have sufficient privileges to start system servic

    I'm trying to re-install itunes on my laptop & I am getting a message that has stopped the re-install & it says: "Service 'Apple Mobile Device" (Apple Mobile Device) failed to start. Verify that you have sufficient privileges to start system services."  The diaglogue box gives me the options to abort, retry, or ignore; when I tried retry and ignore the re-install process stays stalled & the dialogue box comes back & I don't want to abort & start this all over to probably end up with the same issue; what does this mean & what do I do?

    Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features (later)
    Remove all of these items in the following order:
    iTunes
    Apple Software Update
    Apple Mobile Device Support (if this won't uninstall move on to the next item)
    Bonjour
    Apple Application Support
    Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
    The uninstall and reinstall process will preserve your iTunes library and settings, but ideally you would back up the library and your other important personal documents and data on a regular basis. See this user tip for a suggested technique.
    Please note:
    Some users may need to follow all the steps in whichever of the following support documents applies to their system. These include some additional manual file and folder deletions not mentioned above.
    HT1925: Removing and Reinstalling iTunes for Windows XP
    HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
    tt2

  • I just got iphone 5c and i am not happy with it. It uses to much data and i don't even know how. I can't get the ringtones i want for my contacts.I got it on my free upgrade but i want to take it back and get something else but where i got it they say i c

    I just got iphone 5c and i am not happy with it. It uses to much data and i don't even know how. I can't get the ringtones i want for my contacts.I got it on my free upgrade but i want to take it back and get something else but where i got it they say i can't because i don't have the earbuds and i have serches or them. now i am suck with a phone i don't like at all until my next upgrade. this is very dishearten

    1. If you are this unhappy with that phone, and the lost earbuds is the only thing stopping you from taking it back, why do not just buy some earbuds. That way you can get rid of that phone. It all depend upon how much you want to get rid of that phone.
    2. Yet if you are stuck with that iPhone, here is something might help you to control the data usage. By design, iPhones do turn off WiFi when they go dormant. So if a download is in progress and so forth when the phone goes dormant, it will switch to use cellular data, if this setting is left on. Therefore, from multi-sources I have learned that if you keep your iPhone connected to a power source, then it will stay connected to the available WiFi.

  • How can I get a family member back after being removed from family share?

    How can I get a family member back after being removed from family share?

    See [[Replace your Sync information]] but read the cautions carefully.
    * also see [[firefox Sync is not working]]
    It is always a useful precaution to make manual bookmarks backups
    * see [[Backing up and restoring bookmarks]]
    The above article also explains about the autobookmark backups that firefox generates, but be sure to make manual backups as you work, it is very easy to overwrite the wrong set of backups.
    I am not entirely certain what firefox is doing in your case, perhaps the synced Netbook does not have the expected set of bookmarks on it.
    Presumably sync may be uninstalled or disabled like any other add-on
    *see [[Uninstalling add-ons]]

Maybe you are looking for