fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. /* The class name doesn't have to be Main, as long as the class is not public. */
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. int[] a = new int[] { 1, 2, 3 };
  9. method(a);
  10. Class ofArray = a.getClass().getComponentType();
  11. System.out.println(ofArray);
  12. }
  13.  
  14. public static void method(Object o) {
  15. Class ofArray = o.getClass().getComponentType();
  16. System.out.println(ofArray);
  17. }
  18. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
int
int