Online Java Compiler By
JavaTpoint.com
//import statements import java.lang.*; public class ClassgetComponentTypeExample1 { public static void main(String[] args) { String[] arrstr = new String[] {"admin"}; Class aryClass = arrstr.getClass(); Class compoType = aryClass.getComponentType(); if (compoType != null) { System.out.println("The componentType = " + compoType.getName()); // get name of comptype class } else { System.out.println("The ComponentType is null"); } } }
Output