第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在構(gòu)造JSONObject對象時,出現(xiàn)以下現(xiàn)象

在構(gòu)造JSONObject對象時,出現(xiàn)以下現(xiàn)象

晨貓 2016-09-04 21:27:54
public static void main(String[] args) throws JSONException { Persion persion = new Persion(); persion.setName("小明"); persion.setAge(23); String[] major = new String[]{"數(shù)學(xué)","物理"}; persion.setMajor(major); persion.setHas_girlfriend(true); House house = new House("15#204","xx家園",1000000); persion.setHouse(house); persion.setBirthday("1993-04-05"); JSONObject jsonObject = new JSONObject(persion); System.out.println(jsonObject); }結(jié)果:{"birthday":"1993-04-05","major":[{"bytes":[{},{},{},{},{},{}],"empty":false},{"bytes":[{},{},{},{},{},{}],"empty":false}],"name":"小明","has_girlfriend":true,"ignore":null,"house":{"price":1000000,"name":"xx家園","id":"15#204"},"age":23}補充:public class Persion { private String name; private int age; private String[] major; private boolean has_girlfriend; private String birthday; private Object house; private transient String ignore; public String getIgnore() { return ignore; } public void setIgnore(String ignore) { this.ignore = ignore; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public Object getHouse() { return house; } public void setHouse(Object house) { this.house = house; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String[] getMajor() { return major; } public void setMajor(String[] major) { this.major = major; } public boolean isHas_girlfriend() { return has_girlfriend; } public void setHas_girlfriend(boolean has_girlfriend) { this.has_girlfriend = has_girlfriend; } @Override public String toString() { return "Persion [name=" + name + ", age=" + age + ", major=" + Arrays.toString(major) + ", has_girlfriend=" + has_girlfriend + ", birthday=" + birthday + ", house=" + house + "]"; }}public class House { private String id; private String name; private float price; public House() { super(); } public House(String id, String name, float price) { super(); this.id = id; this.name = name; this.price = price; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; }}
查看完整描述

4 回答

?
楓葉梨花

TA貢獻1條經(jīng)驗 獲得超0個贊

我也遇到這個問題不知道怎么解決,樓主解決了嗎??

查看完整回答
反對 回復(fù) 2017-03-29
  • 楓葉梨花
    楓葉梨花
    還是不行哎!完全復(fù)制你的程序也不行??!不知道為什么
  • 晨貓
    晨貓
    那就不要用字符串?dāng)?shù)組了,用集合
?
摩訶迦葉

TA貢獻146條經(jīng)驗 獲得超54個贊

String[] major = new String[]{"數(shù)學(xué)","物理"};改成String[] major = {"數(shù)學(xué)","物理"};

查看完整回答
反對 回復(fù) 2016-09-04
點擊展開后面1
  • 4 回答
  • 0 關(guān)注
  • 2601 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號