⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student.java

📁 JAVA实现的数据结构
💻 JAVA
字号:
import java.io.*;

public class Student extends Personal {
    public int size() {
        return super.size() + majorLen*2;
    }
    protected String major;
    protected final int majorLen = 10;
    Student() {
        super();
    }
    Student(int ssn, String n, String c, int y, long s, String m) {
        super(ssn,n,c,y,s);
        major = m;
    }
    public void writeToFile(RandomAccessFile out) throws IOException {
        super.writeToFile(out);
        writeString(major,out);
    }
    public void readFromFile(RandomAccessFile in) throws IOException {
        super.readFromFile(in);
        major = readString(majorLen,in);
    }
    public void readFromConsole() {
        super.readFromConsole();
        System.out.print("Enter major: ");
        major = kb.next();
        for (int i = major.length(); i < nameLen; i++)
            major += ' '; 
    }
    public void writeLegibly() {
        super.writeLegibly();
        System.out.print(", major = " + major.trim());
    }
    public void copy(DbObject[] d) {
        d[0] = new Student(SSN,name,city,year,salary,major);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -