public class Student { @Property(index = 0) private String name; @Property(index = 1) private int age; // Getters and setters... } FlatFileReader<Student> reader = new FlatFileReader<>(Student.class); List<Student> students = reader.read("students.txt"); int totalAge = 0; for (Student student : students) { totalAge += student.getAge(); } float avgAge = (float) totalAge / students.size(); FlatFileWriter<Student> writer = new FlatFileWriter<>(Student.class); writer.write("result.txt", students);


上一篇:
下一篇:
切换中文