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

java語(yǔ)言

計(jì)算機(jī)二級(jí)JAVA考試要點(diǎn)復(fù)習(xí)

時(shí)間:2024-09-09 13:51:44 java語(yǔ)言 我要投稿
  • 相關(guān)推薦

計(jì)算機(jī)二級(jí)JAVA考試要點(diǎn)復(fù)習(xí)

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

計(jì)算機(jī)二級(jí)JAVA考試要點(diǎn)復(fù)習(xí)

  一、對(duì)象流

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

  對(duì)象流:能夠輸入輸出對(duì)象的流

  將串行化的對(duì)象通過(guò)對(duì)象流寫入文件或傳送到其他地方

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

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

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

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

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

  他們是在字節(jié)流的基礎(chǔ)上加了橋梁作用,所以構(gòu)造他們時(shí)要先構(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();

  }

  }

  }

  }

【計(jì)算機(jī)二級(jí)JAVA考試要點(diǎn)復(fù)習(xí)】相關(guān)文章:

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

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

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

二級(jí)C語(yǔ)言考試復(fù)習(xí)五要點(diǎn)10-28

計(jì)算機(jī)二級(jí)考試:Java語(yǔ)言學(xué)習(xí)六大要點(diǎn)06-08

計(jì)算機(jī)二級(jí)java程序規(guī)范考點(diǎn)復(fù)習(xí)10-03

計(jì)算機(jī)二級(jí)考試Java精選訓(xùn)練題07-20

計(jì)算機(jī)二級(jí)考試JAVA模擬試題10-12

計(jì)算機(jī)二級(jí)考試Java試題及答案10-24

計(jì)算機(jī)二級(jí)JAVA考試精選模擬試題08-12

主站蜘蛛池模板: 贵定县| 碌曲县| 唐海县| 周至县| 行唐县| 胶州市| 永定县| 商洛市| 乌拉特中旗| 遂川县| 西宁市| 长子县| 澄城县| 大关县| 大庆市| 西林县| 睢宁县| 沅江市| 色达县| 兴海县| 前郭尔| 孟连| 屯留县| 敖汉旗| 临清市| 泽普县| 肇州县| 象州县| 深水埗区| 涪陵区| 玉林市| 云南省| 桂阳县| 堆龙德庆县| 贞丰县| 长汀县| 三穗县| 大石桥市| 泽库县| 肃北| 阜南县|