兩段很有意思的代碼
/** * 測試引用 */ @Test public void testYinyong() { Map<String, Object> map = new HashMap<String, Object>(); JSONObject json = new JSONObject(); json.put("t1", "t1"); map.put("json", json); System.out.PRintln(map); json.put("t2", "t2"); System.out.println(map); } /** * 測試引用 */ @Test public void testYinyongV2() { Map<String, String> map = new HashMap<String, String>(); JSONObject json = new JSONObject(); json.put("t1", "t1"); map.put("json", json.toString()); System.out.println(map); json.put("t2", "t2"); System.out.println(map); }同樣代碼,只是map 的數(shù)據(jù)差別,前面代碼段輸出兩行結(jié)果不同,后面代碼段結(jié)果相同
|
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注