Get the Component Type of an Array Object in Java

Description

The following code shows how to get the Component Type of an Array Object.

Example


//from  w  ww . j av  a2 s . c o m
public class Main {
  public static void main(String[] argv) throws Exception {
    Object o = new int[1][2][3];

    o.getClass().getComponentType();
  }
}




















Home »
  Java Tutorial »
    Reflection »




Annotation
Array
Class
Constructor
Field
Generics
Interface
Method
Modifier
Package
Proxy