How do you show type in Java?

We can check the type of a variable in Java by calling getClass(). getSimpleName() method via the variable . The below example illustrates the use of this function on non-primitive data types like String . The below example illustrates the use of this method on an array.

Read more