|
public void setName(String name) { StringBuilder builder = null; if(name != null) builder = new StringBuilder(name); else builder = new StringBuilder(15); builder.setLength(15); this.name = builder.toString(); }
public void setScore(int score) { this.score = score; }
public String getName() { return name; }
public int getScore() { return score; }
// 每笔记录固定写入34个字节
public static int size() { return 34; } }
public class RandomAccessFileDemo { public static void main(String[] args) { Student[] students = { new Student("Justin", 90), new Student("momor", 95), new Student("Bush", 88), new Student("caterpillar", 84) };
[1] [2] [3] 下一页
|