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

java語言

計算機二級JAVA考試要點復(fù)習(xí)

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

計算機二級JAVA考試要點復(fù)習(xí)

  知識就是靠積累起來的,經(jīng)驗也是積累起來的。以下是百分網(wǎng)小編整理的計算機二級JAVA考試要點復(fù)習(xí),歡迎學(xué)習(xí)!

計算機二級JAVA考試要點復(fù)習(xí)

  一、對象流

  串行化:對象通過寫出描述自己狀態(tài)的數(shù)值來記述自己的過程叫串行話

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

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

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

  注意:只有實現(xiàn)了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,所以叫做字節(jié)流,寫入文件的都是二進制字節(jié),我們無法直接看,下面要學(xué)習(xí)的是字節(jié)流

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

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

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

  他們是在字節(jié)流的基礎(chǔ)上加了橋梁作用,所以構(gòu)造他們時要先構(gòu)造普通文件流

  我們常用的是:

  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考試要點復(fù)習(xí)】相關(guān)文章:

計算機二級考試java要點知識復(fù)習(xí)07-05

計算機二級Java要點知識的復(fù)習(xí)09-28

2017計算機二級JAVA要點知識復(fù)習(xí)11-06

2017年java考試要點復(fù)習(xí)題08-10

2017計算機二級考試JAVA考前復(fù)習(xí)題08-05

二級C語言考試復(fù)習(xí)五要點10-28

二級建造師考試復(fù)習(xí)要點09-04

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

計算機二級JAVA考試構(gòu)建JAVA程序201710-02

主站蜘蛛池模板: 威海市| 丰镇市| 仁布县| 长春市| 渝中区| 阳城县| 汶川县| 舞钢市| 望城县| 阿合奇县| 屏东县| 方城县| 贡觉县| 财经| 民勤县| 永嘉县| 武胜县| 鲁甸县| 洞口县| 保靖县| 砚山县| 湖州市| 慈溪市| 中超| 四川省| 珠海市| 江永县| 罗定市| 个旧市| 大同县| 潞西市| 柳江县| 绥化市| 定边县| 安福县| 金秀| 南江县| 右玉县| 英德市| 武邑县| 平乐县|