奶头挺立呻吟高潮av全片,成人试看120秒体验区,性欧美极品v,A片高潮抽搐揉捏奶头视频

java語言

計算機二級JAVA考試要點復習

時間:2025-06-03 21:31:28 java語言 我要投稿

計算機二級JAVA考試要點復習

  知識就是靠積累起來的,經驗也是積累起來的。以下是百分網小編整理的計算機二級JAVA考試要點復習,歡迎學習!

計算機二級JAVA考試要點復習

  一、對象流

  串行化:對象通過寫出描述自己狀態的數值來記述自己的過程叫串行話

  對象流:能夠輸入輸出對象的流

  將串行化的對象通過對象流寫入文件或傳送到其他地方

  對象流是在普通流上加了傳輸對象的功能,所以構造對象流時要先構造普通文件流

  注意:只有實現了Serializable接口的類才能被串行化

  例子:

  import java.io.*;

  class Student implements Serializable{

  private String name;

  private int age;

  public Student(String name,int age){

  this.name=name;

  this.age=age;

  }

  public void greeting(){

  System.out.println("hello ,my name is "+name);

  }

  public String toString(){

  return "Student["+name+","+age+"]";

  }

  }

  public class ObjectOutTest{

  public static void main(String args[]){

  ObjectOutputStream oos=null;

  try{

  oos=new ObjectOutputStream(

  new FileOutputStream("student.txt"));

  Student s1=new Student("Jerry",24);

  Student s2=new Student("Andy",33);

  oos.writeObject(s1);

  oos.writeObject(s2);

  }catch(Exception e){

  e.printStackTrace();

  }finally{

  if(oos!=null)

  try{

  oos.close();

  }catch(Exception e){

  e.printStackTrace();

  }

  }

  }

  }

  import java.io.*;

  public class ObjectInTest{

  public static void main(String args[]){

  ObjectInputStream ois=null;

  Student s=null;

  try{

  ois=new ObjectInputStream(

  new FileInputStream("student.txt"));

  System.out.println("--------------------");

  s=(Student)ois.readObject();

  System.out.println(s);

  s.greeting();

  System.out.println("--------------------");

  s=(Student)ois.readObject();

  System.out.println(s);

  s.greeting();

  }catch(Exception e){

  e.printStackTrace();

  }finally{

  if(ois!=null)

  try{

  ois.close();

  }catch(Exception e){

  e.printStackTrace();

  }

  }

  }

  }

  二、字符流 InputStreamReader/OutputStreamWriter

  上面的幾種流的單位是 byte,所以叫做字節流,寫入文件的都是二進制字節,我們無法直接看,下面要學習的是字節流

  Java采用 Unicode 字符集,每個字符和漢字都采用2個字節進行編碼,ASCII 碼是 Unicode 編碼的自集

  InputStreamReader 是 字節流 到 字符橋的橋梁 ( byte->char 讀取字節然后用特定字符集編碼成字符)

  OutputStreamWriter是 字符流 到 字節流的橋梁 ( char->byte )

  他們是在字節流的基礎上加了橋梁作用,所以構造他們時要先構造普通文件流

  我們常用的是:

  BufferedReader 方法:readLine()

  PrintWriter 方法:println()

  例子:

  import java.io.*;

  public class PrintWriterTest{

  public static void main(String args[]){

  PrintWriter pw=null;

  try{

  pw=new PrintWriter(

  new OutputStreamWriter(

  new FileOutputStream("bufferedwriter.txt")));

  pw.println("hello world");

  }catch(Exception e){

  e.printStackTrace();

  }finally{

  if(pw!=null)

  try{

  pw.close();

  }catch(Exception e){

  e.printStackTrace();

  }

  }

  }

  }

  import java.io.*;

  public class BufferedReaderTest{

  public static void main(String args[]){

  BufferedReader br=null;

  try{

  br=new BufferedReader(

  new InputStreamReader(

  new FileInputStream("bufferedwriter.txt")));

  System.out.println(br.readLine());

  }catch(Exception e){

  e.printStackTrace();

  }finally{

  if(br!=null)

  try{

  br.close();

  }catch(Exception e){

  e.printStackTrace();

  }

  }

  }

  }

【計算機二級JAVA考試要點復習】相關文章:

計算機二級考試java要點知識復習07-05

計算機二級Java要點知識的復習09-28

2017計算機二級JAVA要點知識復習11-06

2017年java考試要點復習題08-10

2017計算機二級考試JAVA考前復習題08-05

二級C語言考試復習五要點10-28

二級建造師考試復習要點09-04

計算機二級考試JAVA試題08-04

計算機二級JAVA考試構建JAVA程序201710-02

主站蜘蛛池模板: 南江县| 本溪市| 乌恰县| 普兰店市| 正镶白旗| 白玉县| 津南区| 周口市| 溧阳市| 水城县| 东兰县| 宣汉县| 略阳县| 玛沁县| 巴里| 武陟县| 汉源县| 琼海市| 施甸县| 宜君县| 桑日县| 澄城县| 安乡县| 山东省| 仙游县| 连云港市| 分宜县| 宜兴市| 古交市| 彭水| 伊吾县| 屯昌县| 大洼县| 禄劝| 新野县| 全椒县| 永和县| 道真| 鹤壁市| 依安县| 伊宁县|