計算機二級JAVA考試考點知識

來源:文萃谷 1.95W

學習是一個循序漸進的過程,需要同學們不斷的學習和努力。計算機二級JAVA考試考點知識就為大家分享這裏了,希望能幫助大家更好的複習所學的知識。

計算機二級JAVA考試考點知識

  一、隨機存取文件 RandomAccessFile

可同時完成讀寫操作

支持隨機文件操作的方法:

readXXX()/writeXXX()

seek() 將指針調到所需位置

getFilePointer() 返回指針當前位置

length() 返回文件長度

例子:把若干個32位的'整數寫到一個名為 “”的文件中,然後利用seek方法,以相反的順序再讀取這些數據

import .*;

public class RandomFile{

public static void main(String args[]){

RandomAccessFile raf=null;

int data[]={12,31,56,23,27,1,43,65,4,99};

try{

raf=new RandomAccessFile("","rw");

for(int i=0;i

eInt(data);

for(int i=th-1;i>=0;i--){

(i*4);

tln(Int());

}

}catch(Exception e){

essage();

}finally{

if(raf!=null)

try{

e();

}catch(Exception e){

essage();

}

}

}

  二、小結

這部分的難點就是類比較複雜,尤其是每個類的構造方式,我認為記住下面這個圖比記類的繼承關係更好些

字節流:

InputStream

|-- FileInputStream (基本文件流)

|-- BufferedInputStream

|-- DataInputStream

|-- ObjectInputStream

OutputStream 同上圖

BufferedInputStream DataInputStream ObjectInputStream 只是在 FileInputStream 上增添了相應的功能,構造時先構造FileInputStream

字符流:

Reader

|-- InputStreamReader (byte->char 橋樑)

|-- BufferedReader (常用)

Writer

|-- OutputStreamWriter (char->byte 橋樑)

|-- BufferedWriter

|-- PrintWriter (常用)

隨機存取文件 RandomAccessFile


更多計算機二級JAVA相關文章分享:

1.2017年計算機二級Java備考題及答案

2.2017年3月計算機二級Java備考習題

3.計算機二級考試java基礎知識

4.2017年計算機二級Java強化試題及答案

5.2017計算機等級考試二級Java重點內容

6.2017計算機二級JAVA考試鞏固試題及答案

7.計算機二級考試Java精選訓練題

8.計算機二級考試:Java語言學習六大要點

9.計算機二級《Java語言程序設計》考試知識點

10.2017計算機二級JAVA常考知識複習

熱門標籤