应该是把数据读到byte[] b中的,我如何从这个数组中将数据提取出来呢?

解决方案 »

  1.   

    //郁闷了一天了,谁帮我解决呀import java.io.*;public class Test{
      
      public static void main(String[] args) throws IOException{
        RandomAccessFile raf = new RandomAccessFile("hello.txt","rw");
        raf.writeBytes("Hello,java friend.");
      
    // 请问如何能将hello.txt文件中的"llo,java"输出来!
       
      }
    }
      

  2.   

    用这个:
       ...
       byte[] bytes = new byte[18];
       int n = raf.read(bytes);
       System.out.println(new String(bytes,2,8));
       ...Good luck!