print java object inherited classes

Solutions on MaxInterview for print java object inherited classes by the best coders in the world

showing results for - "print java object inherited classes"
Alessandra
13 Jun 2017
1
2//package com.java2s;
3
4import static java.lang.System.out;
5
6public class Main {
7    public static void printInheritanceTree(Class<?> c) {
8        out.format("Inheritance Tree => %n");
9        Class<?> ancestor = c.getSuperclass();
10
11        while (ancestor != null) {
12            out.format("  %s%n", ancestor.getCanonicalName());
13            ancestor = ancestor.getSuperclass();
14        }// w w  w .  ja  v  a 2s.co  m
15        out.format("%n%n");
16    }
17}
18
similar questions
queries leading to this page
print java object inherited classes