Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created May 31, 2020 04:55
Show Gist options
  • Save justdoit0823/bec9299421ac5a9c287f9454657ef9f3 to your computer and use it in GitHub Desktop.
Save justdoit0823/bec9299421ac5a9c287f9454657ef9f3 to your computer and use it in GitHub Desktop.
Show default class object info in java.
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