java.lang.Class.getComponentType()


java.lang.Class.getComponentType()

package com.codingdict;



import java.lang.*;



public class ClassDemo {



   public static void main(String[] args) {



      String[] arr = new String[] {"admin"};



      // returns the Class representing the component type

      Class arrClass = arr.getClass();

      Class componentType = arrClass.getComponentType();

      if (componentType != null) {

         System.out.println("ComponentType = " + componentType.getName());

      } else {

         System.out.println("ComponentType is null");

      }

   }

}