/**
* @author lautturi.com
* Java example: determine the object data type in java
*/
import java.util.*;
public class Lautturi {
public static void main(String[] args) {
Object[] mixedObjects = new Object[] { "Hello", true, 1, new StringBuilder("Hello there"), new String[10] };
for (Object item : mixedObjects) {
System.out.println(item.getClass().getSimpleName());
}
}
}Souww:ecrw.lautturi.comoutput:
String Boolean Integer StringBuilder String[]