Object[] o = new Object[2];
o[0] = 1;
o[1] = "aaa";
for (int i = 0; i < o.length; i++) {
if (o[i] instanceof Integer) {
int num = (int) o[i];
} else if (o[i] instanceof String) {
String str = (String) o[i];
}
}
追é®æçæææ¯intåstringé½æ¾å¨ä¸ä¸ªæ°ç»ä¸
追ç Object[] o = new Object[2];
o[0] = 1;
o[1] = "aaa";
è¿ä¸å°±æ¯åä¸ä¸ªæ°ç»ä¹ï¼ç¬¬ä¸ä¸ªæ¯1ï¼intåï¼ç¬¬äºä¸ªæ¯âaaaâStringåï¼åªä¸è¿ååºçæ¶åéè¦è¿è¡ç±»åå¤æ