String test="你好";
//test(test);
Map<String,String> map=new HashMap<String,String>();
map.put("groupName", "groupName-1");
map.put("type",1+"");
//test(test);
Map<String,String> map=new HashMap<String,String>();
map.put("groupName", "groupName-1");
map.put("type",1+"");
test(map);
检测如下:
public static void test(Object obj){
if(obj instanceof String){
System.out.println("字符串对象");
}if(obj instanceof Map){
System.out.println("Map对象");
}else{
System.out.println("其他对象");
}
}