java题库10
1.
? ? ? 可變參數的使用規則:
? ?? 1.最后一個參數,前不能由非可變參數
? ? ? ? 2.如果有同名的非可變參數函數,優先匹配
? ? ? ? 3.如果有兩個可以匹配的可變參數函數,錯誤
2.
static final int[] a = { 100,200 };
B.static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
C.static final int[] a = new int[2]{ 100,200 };
D.static final int[] a;?
static void init() { a = new int[3]; a[0]=100; a[1]=200; }
只有A B合法
3.
? ? ? ?同名變量就近原則
4.
? run()方法:在本線程內調用該Runnable對象的run()方法,可以重復多次調用;
start()方法:啟動一個線程,調用該Runnable對象的run()方法,不能多次啟動一個線程;
5.
short 和Short是不同的
6.
Locale.setDefault(new Locale("fr", "FRANCE", "MAC"));The method setLocale(Locale) is undefined for the type DateFormat
7.
Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object? (Choosetwo.)
A. When using versions of Java technology earlier than 5.0.
B. When sharing a StringBuffer among multiple threads.
C. When using the java.io class StringBufferInputStream.
D. When you plan to reuse the StringBuffer to build more than one string.
Answer: AB
Section: All?
8.
Console中readpassword返回的是char[]而不是string
9.
\s必須使用轉義\
10.
全局變量: return(i++); ? <==> ?return i ; i=i+1;
局部變量: return(i++); ? <==> ?return i ; //應該沒有i=i+1這個動作發生了
總結