fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String[] strs = {};
  13.  
  14. System.out.println("The class of strs is " + strs.getClass());
  15. System.out.println(strs.getClass().equals(String[].class));
  16. System.out.println(strs.getClass().equals(String.class));
  17. System.out.println("The superclass of strs is " + strs.getClass().getSuperclass());
  18.  
  19. int[] ints = {};
  20.  
  21. System.out.println("The class of ints is " + ints.getClass());
  22. System.out.println(ints.getClass().equals(int[].class));
  23. System.out.println(ints.getClass().equals(int.class));
  24. System.out.println("The superclass of ints is " + ints.getClass().getSuperclass());
  25. }
  26. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
The class of strs is class [Ljava.lang.String;
true
false
The superclass of strs is class java.lang.Object
The class of ints is class [I
true
false
The superclass of ints is class java.lang.Object