studentdata.java

来自「以随机存取二进制度方式保存下列数据(rbi.dat),并从该二进制文件中读取数据」· Java 代码 · 共 40 行

JAVA
40
字号

import java.io.*;


	class StudentData {
		String a;String b;String c ;int d;String e;int f;
		public StudentData(String w,String x,String i,int y,String z,int j){
		   a=w;b=x;c=i;d=y;e=z;f=j;
		  }
		
	public void show(){
		System.out.print(this.a+",");
		System.out.print(this.b+",");
		System.out.print(this.c+",");
		System.out.print(this.d+",");
		System.out.print(this.e+",");
		System.out.print(this.f);
		System.out.println("");
	}

	public void save(RandomAccessFile  temp,int i)throws Exception{
     temp.seek(i*80);
		temp.writeUTF(this.a);temp.seek(10+i*80);
     temp.writeUTF(this.b);temp.seek(30+i*80);
     temp.writeUTF(this.c);temp.seek(40+i*80);
     temp.writeInt(this.d);temp.seek(50+i*80);
     temp.writeUTF(this.e);temp.seek(70+i*80);
     temp.writeInt(this.f);
	}
	public void load(RandomAccessFile temp,int i)throws Exception{
		
		
	}
		
	}




⌨️ 快捷键说明

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