Created
May 31, 2020 04:55
-
-
Save justdoit0823/bec9299421ac5a9c287f9454657ef9f3 to your computer and use it in GitHub Desktop.
Show default class object info in java.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
class DefaultClassShow { | |
public static void main(String... args) { | |
byte[] b = new byte[]{1, 2, 3}; | |
char[] c = new char[]{1, 2, 3}; | |
List<Class> classes = Arrays.asList( | |
b.getClass(), | |
c.getClass() | |
); | |
classes.forEach(kc -> { | |
System.out.println("class:" + kc); | |
System.out.println("canonical name:" + kc.getCanonicalName()); | |
System.out.println("super class:" + kc.getSuperclass()); | |
System.out.println("type name:" + kc.getTypeName()); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment