How do I get the component type of an array?

The Class.getComponentType() method call returns the Class representing the component type of an array. If this class does not represent an array class this method returns null reference instead.

This program print the following output:

How do I determine if a class object represents an array class?

For checking if a class object is representing an array class we can use the isArray() method call of the Class object. This method returns true if the checked object represents an array class and false otherwise.

How do I check if a class represent an interface type?

You can use the isInterface() method call of the java.lang.Class to identify if a class objects represent an interface type.

Here is the result of the program: