位置: 首頁 > IT認證 > JAVA認證

2016年Java考試精選程式閱讀題

2016-11-07 JAVA認證

  1.寫出以下程式的執行結果。

class First {

First(  ) {

tln ("in First"); } }

public class Second extends First { Second(  ) {

tln("in Second"); } public static void main(String[] args) { Second mine= new Second(  ); } }

程式執行的結果:

in First in Second

  2.解釋程式中語句的'含義

文字檔案中的內容是 abcd

下面的程式將檔案中的內容寫到檔案中和螢幕上 import .*;

public class filecopy {

public static void main(String[] args) { try {

StringBuffer str=new StringBuffer(  );

FileInputStream fin=new FileInputStream("");

意義

FileOutputStream fout=new FileOutputStream("");

意義

int c;

while((c=(  ))!=-1) {

e(c); 意義

nd((char)c); 意義

}

e(  ); e(  );

String str2=ring(  );

tln(str2); 顯示的結果是

}catch(Exception c) {

tln(c); } } }

例項化輸入流物件,指定輸入流來原始檔為 例項化輸出流物件,指定輸出流目標檔案為 將C寫入到輸出流物件中

將整數C轉化為字元,並新增到字串str的尾部 abcd

標籤:JAVA 考試 精選 閱讀
2016-10-24
2016-11-14
2016-08-01
2017-12-13
2016-06-19
2016-09-08
2017-12-13
2019-09-19
2016-11-07
2016-06-19

Copyright ©2024 才華齋 All Rights Reserved.