public class CheckingObjects {
public static void main(String[] args) {
// TODO Auto-generated method stub
String strArr[] =new String[2];
strArr[0] ="wil";
strArr[1] ="bert";
String str = "String content";
String strVal = String.valueOf(str);
// checking if string object or array object
if("java.lang.String".equals(strVal.getClass().getName())){
System.out.println("string");
}else{
System.out.println("array");
}
if (str instanceof java.lang.String) {
System.out.println("true");
} else {
System.out.println("false");
}
}
}