java2期末考试试题及答案_《JAVA语言程序设计》期末考试试题及答案(2)
System.out.print(s.charAt(i));
}
A) aceg B) ACEG C) abcdefg D) abcd
2、有整型數組:int[] x={12,35,8,7,2};,則調用方法Arrays.sort(x)后,數組x中的元素值依次是( A ).
A) 2 7 8 12 35 B) 12 35 8 7 2
C) 35 12 8 7 2 D) 8 7 12 35 2
3、下面的程序段創建了BufferedReader類的對象in,以便讀取本機c盤my文件夾下的文件1.txt。File構造函數中正確的路徑和文件名的表示是( C )。
File f = new File(填代碼處);
file =new FileReader(f);
in=new BufferedReader(file);
A) "./1.txt" B) "../my/1.txt" C) "c:\\my\\1.txt" D) "c:\ my\1.txt"
4、應用程序的main方法中有以下語句,則輸出的結果是( A )。
String s1=new String("abc");
String s2=new String("abc");
boolean b1=s1.equals(s2);
boolean b2=(s1==s2);
System.out.print(b1+" "+b2);
A)true false B) false true C) true true D)false false
5、應用程序的main方法中有以下語句,則輸出的結果是( B )。
Hashtable hashtable=new Hashtable();
hashtable.put("x","12345");
hashtable.put("y","67890");
hashtable.put("a","abcde");
System.out.println(hashtable.get("a"));
A) a B) abcde C) 12345 D) 67890
6、下面語句的功能是( A )。
RandomAccessFile raf2 = new RandomAccessFile("1.txt","rw" );
總結
以上是生活随笔為你收集整理的java2期末考试试题及答案_《JAVA语言程序设计》期末考试试题及答案(2)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java filesystem_Java
- 下一篇: php7不兼容phalcon_Phalc