print Superclass - Java Reflection

Java examples for Reflection:Class

Description

print Superclass

Demo Code


//package com.java2s;

import static java.lang.System.out;

public class Main {
    public static void printSuperclass(Class<?> c) {
        Class<?> superClass = c.getSuperclass();
        if (null != superClass) {
            out.format("Superclass => %s", superClass.getName());
        } else {//from   w  w w.  j a va  2 s  .c  o m
            out.format("Superclass => No superclass");
        }
        out.format("%n%n");
    }
}

Related Tutorials