假定txt文件中每行的内容为:姓名,年龄,密码 各字段用“,”(逗号)分隔,编写代码以下:import java.io.*;import java.util.*;public class Test{public static void main(String args ){ArrayListUser userInfo=new ArrayListUser();try{BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(d:\\userinformation.txt)));String str=null;while((str=br.readLine())!=null){String inf=str.split(,);String name=inf ;String password=inf ;int age=Integer.parseInt(inf );userInfo.add(new User(name,age,password));}}catch(Exception e) }}class User{private String name=null;private int age=0;private String password=null;public User(String name,int age,String password) } 查看原帖>>