example7_7.java
来自「《Java程序设计与应用》-张仕斌-源程序 《Java程序设计与应用》-张仕斌」· Java 代码 · 共 45 行
JAVA
45 行
/*
* Example7_7.java
*
* Created on 2006年9月16日, 上午12:31
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package example7_7;
import java.io.*;
/**
*
* @author Administrator
*/
public class Example7_7 {
/** Creates a new instance of Example7_7 */
public Example7_7() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// TODO code application logic here
RandomAccessFile in_and_out=null;
int data[]={1,2,3,4,5};
try{in_and_out=new RandomAccessFile("tom.dat","rw");}
catch(Exception e){}
try{ for(int i=0;i<data.length;i++){in_and_out.writeInt(data[i]);}
for (long i=data.length-1;i>=0;i--)
{in_and_out.seek(i*4);
System.out.print(","+in_and_out.readInt());
}
in_and_out.close();
}
catch(IOException e){}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?