你好,这个报错如何解决?
代码如下:
package json;
import java.io.File;
public class JsonObjectSample {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
private static void jSONObjectSample(){
JSONObject wangxiaoer = new JSONObject();
Object nullObj = null;
try{
wangxiaoer.put("name","王小二");
wangxiaoer.put("age",25.2);
System.out.println(wangxiaoer.toString());
}catch(JSONException e){
e.printStackTrace();
}
}
private static void createJsonByMap(){
Map<String,Object> wangxiaoer = new HashMap<String,Object>
wangxiaoer.put("name","王小二");
wangxiaoer.put("age",25.2);
System.out.println(new JSONObject(wangxiaoer).toString());
}
}
}