判断题
1-1 JLable
can contain other components.
false
1-2 A local class or anonymous class cannot access all local variables from the enclosing method.
true
1-3 Using JPanel p = new JPanel(); BoxLayout b1 = new BoxLayout(p, BoxLayout.X_AXIS);
can set the BoxLayout for Panel p.
false
单选题
2-1 Which one below is the correct signature of InputStream.read()
?
byte read()
char read()
int read()
long read()
C
2-2 Which of these methods will make a thread leave the running state, and the method is not static?
notify()
Thread.KillThread()
yield()
wait()
D
2-3 Which one below is NOT a valid Java identifier?
const
$2
Double
名字
A
2-4 Choose the best fill in the blanks.
1 | class Hello2017 |
new Century(“Hello”).start();
new Thread(“Hello”).start();
new Century(new Thread()).start();
new Thread(new Century()).start();
A
2-5 For object o
and class C
, which expression below is the right way to test if o
is an object of C
?
C.isInstance(o)
o.class == C
o instanceof C
o.getClass() == C
not D
2-6
1 | int x=0x80000000; |
output:
OK
NOT
overflow
error ( compilation or run-time)
A
2-7 Which of the following is NOT correct?
A Generic Type Parameter of a Class Is Not Allowed in a Static Context
Cannot Create an Instance of a Generic Type. (i.e., new E()).
Generic Array Creation is Not Allowed. (i.e., new E[100]).
Exception Classes Can be Generic.
not C
2-8
1 | List<Double> ls = new ArrayList<Double>(); |
It compiles but exception raises at line 3
It does not compile
It compiles but exception raises at line 2
It compiles but exception raises at line 4
B
填空题
3-1
1 | public class Test { |
false
true
111c3111t3
3-2
1 | IntStream.range(2, 10). |
27
3-3
1 | class A { |
3
2
7
3-4
1 | public class Test { |
false
false
true
to be done:
解释