122. What can you put where the X is?0 o. ^% J) w% o, s: m1 A
X& ?2 M/ V( l) f- a. Q
Public class A{}
( k2 t5 U' K: S- Y8 T* S; [9 C; pA. import java.awt.*;8 g- T' B' `, V1 v! E
B. package bla.bla;" f% N, _2 e9 Q' d
C. class bla{}3 _! r/ p+ `, O+ n2 B$ r
D. public abstract final method();1 d8 H x! q% J4 t
E. public final int x = 1000;# w! I2 p U" t, g! |
ABC.
6 S9 E5 T* a' ~# w3 T) w* S123. What are the characteristics of a totally encapsulated class? One answer.9 G, N0 s# U' M
A. methods not private! e) P- j* r. E4 N! F" }
B. variables not public+ }. [0 ?( S5 [# w* V
C. ......) Y8 S2 D+ ?: D
D. all modifying of the object should be made through methods. H& b8 X, X, [/ T
D.' H" I: | {% m3 C7 ?, E
124. Consider the following code:
+ Q" V A: S8 J+ O/ k& x# Npublic class TBMock1{
5 F) U+ O" S) r* k& H/ wpublic static void main(String[]args){
L( k* C2 z: wInteger n = new Integer(7);
- ?) G" B7 B5 \, ^ h% n5 n3 sInteger k = new Integer(7);
: g/ d5 z1 g' y9 _# a8 R' j" N8 RLong i = new Long(7);+ g# [7 N! _5 l! s
}
3 ?- P) A* c$ [" T- e* i}
% A6 N6 m* A. ]3 q+ L2 }Which return true?' h: o) Q: X% ?( \9 | y
A. n==i8 `. p* @) B3 R n! i
B. n==k
9 U B1 w; q I& mC. n.equals(k)
5 I* L0 ^" o R p7 h: JD. n.equals(7)# `# \2 }2 M1 @2 [1 V1 D
E. n.equals(new Integer(7))6 w! Y( {( T: H) o4 X7 b' t$ x& i2 Q
CE.# e- {$ f$ y: v$ j; V
125. Write 7 in hexadecimal. Do not use more than four characters and do no assignment./ h% z: Z ]0 u; m0 N2 }
Answer:3 Q9 y: d1 @5 r8 ? @7 B
0x7, 0x07
5 V% c' Z4 d8 o$ H126. Consider the classes defined below:
% o: C1 O8 ~$ [% f% Cimport java.io.*;
8 D! Z# k d" b- d/ cclass Super{, b; D' S9 D( [2 J
void method (int x, int b)8 L+ Q, z7 H7 z
}8 O( n$ H& ~) Q* }- N: ]+ D
class Sub extends Super{}
+ y: M7 m1 H9 A8 LHow will a correct method in Sub look like?! w- u0 S' k& `4 B/ W
A. int method(int x, int b)
4 e/ u4 T# ^) g) C9 ^, \8 sB. void method (int x) throws Exception$ R# ?4 t+ g) p5 ]; f
C. void anotherMethod(int x)7 _( t) r8 `; |4 Z' V/ m
D. ........, Q* ?7 P; w/ @, W) h" |+ [
BC. |