Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

check java variable type using getSimpleName method

package javaapplication;

public class Employee {

    public static void main(String args[]) {

       
        Object[] mixedObjects = new Object[]{"Hello", true, 1, new StringBuilder("Hello there"), new Employee(), new String[10]};

        for (Object item : mixedObjects) {
            System.out.println(item.getClass().getSimpleName());
        }

    }
}
Source by www.quizcure.com #
 
PREVIOUS NEXT
Tagged: #check #java #variable #type #getSimpleName #method
ADD COMMENT
Topic
Name
9+4 =