@Override public List readQuestion() throws IOException { Gson gson = new Gson(); //创建 Gson 实例 Daolmpl d = new Daolmpl(); String str = null; try { str = d.read("question.txt"); //从文件中读取字符串 } catch (IOException e) { throw new RuntimeException(e); } List qs = gson.fromJson(str, new TypeToken<List>() {}.getType()); //将字符串转化为 Question 对象列表 return qs; //返回 Question 对象列表 }

@Override public String parseResult(List list) throws IOException { System.out.println(list); //输出列表中的字符串 return ""; }

Override public ListQuestion readQuestion throws IOException Gson gson = new Gson;创建 Gson 实列 Daolmpl d=new Daolmpl; String str=null; try str = dreadquestion

原文地址: http://www.cveoy.top/t/topic/bZXk 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录