get函數(shù)調(diào)用很簡單.就先創(chuàng)建一個你自己構(gòu)建的JavaBean對象,比如我這兒是Man wang2 = new Man();
然后在后面直接寫wang2.setName("wangxiaoer");就行了. 在 . 后面寫setN之后就會有提示了
然后在后面直接寫wang2.setName("wangxiaoer");就行了. 在 . 后面寫setN之后就會有提示了
2017-09-27
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
2017-09-24
這樣就不會錯了。
private static void mapJson(){
Map<String,Object> jo=new HashMap<String,Object>();
jo.put("car", null);
jo.put("girl",new String[]{"張柏芝","張靚穎"});
JSONObject js=new JSONObject();
js.putAll(jo);
System.out.println(js);}
private static void mapJson(){
Map<String,Object> jo=new HashMap<String,Object>();
jo.put("car", null);
jo.put("girl",new String[]{"張柏芝","張靚穎"});
JSONObject js=new JSONObject();
js.putAll(jo);
System.out.println(js);}
2017-09-19
前面說省略toString的真是夠了,老師已經(jīng)說了建議Javabean都實現(xiàn),還要老師給你敲出來,你這根本不是新手,估計是剛接觸吧!
2017-09-17