读取文件时候空指针异常
//获取文件
File file = new File(ReadJSONSample.class.getResource("/wxe.json").getFile());
if(file == null){
System.out.print("空指针异常");
}else{
System.out.print(file.getName());
//读取文件内容
String content = FileUtils.readFileToString(file,"utf-8");
JSONObject jsonObject = new JSONObject(content);
System.out.print("姓名是:" + jsonObject.getString("name"));
System.out.print("年龄是:" + jsonObject.getDouble("age"));
System.out.print("是否有女朋友:" + jsonObject.getBoolean("has_girlfriend"));
System.out.print("姓名是:" + jsonObject.getString("name"));
}