摘要: public Student[] readFile(String path) { String str = null;String[] array = null;Student[] stus = new Student[4]; //Student 持久化对象类int i = 0;FileReader file = null;BufferedReader read = null;try {file = new FileReader(path); //path 指定文件的路径read = new BufferedReader(file);while ((str = read.readLine()) 阅读全文
posted @ 2013-03-06 14:29 IT稻草 阅读(915) 评论(0) 推荐(0)
摘要: List,Set转换为数组的方法。toArray函数有两种形式,一种无参数,一种带参数,注意带参数形式中,要指明数组的大小。程序代码:List----数组Set----数组 public void convertCollectionToArray() { List list = new ArrayList(); Object[] objectArray1 = list.toArray(); String[] array1 = list.toArray(new String[list.size()]); Set set = new HashSet(); Object[] objectArray2 阅读全文
posted @ 2013-03-06 14:27 IT稻草 阅读(217) 评论(0) 推荐(0)