question 45 what will happen when you try compiling and running this code?5 q3 g1 K) f4 G4 Q. F
public class ref{8 H/ p) D& Q" R2 _
public static void main(string argv[]){
1 V7 W$ K x' F0 K0 ]8 ]; a6 q ref r = new ref();
' C5 v& ~7 C7 d' Q& j# C0 m: w6 V r.amethod(r);. K# O- o* h) F
}: _% l B- f0 ] k
public void amethod(ref r){5 D: t, R- S7 k$ x: n
int i=99;0 s) h% v: F& n* U( ?1 w
multi(r);
. F' N3 f3 g3 b# t1 |7 w* D system.out.println(i);6 q. J2 @+ F/ U( @) L
}* s; B9 o j, b- T
public void multi(ref r){$ O# i7 }, G: j# \3 ~) w
r.i = r.i*2;4 x4 L! T; g' w2 t5 A
}* }7 ]3 ~7 {3 B. S1 \3 {
}
y4 f$ D5 S4 o0 c 1) error at compile time
# Q: h) f, l# |( E; O 2) an output of 99
2 x& i2 J5 Q9 A/ o5 a, x3 m 3) an output of 198
! q" g- F" L+ L2 z 4) an error at runtime
. u/ F. M) ?9 z$ Y; W answer to question 45
% |! w, Q5 `( G% ]5 c --------------------------------------------------------------------------------
& ?- g8 s1 j( k0 _* { question 46)
/ R0 |% D! I5 B* @8 C3 y you need to create a class that will store unique object elements. you do not need to sort these elements but they must be unique.
m L. D& _6 v$ N) @3 ` what interface might be most suitable to meet this need?
5 V9 K: d. e' ]5 T/ [ 1)set
3 v$ ~8 R, Z, \4 r. f4 Z 2)list
, f5 F0 h7 N' Q0 r, p8 `; L 3)map4 P0 m% f0 V1 ?% J3 G' T* J
4)vector
6 |$ T5 Q. a8 X+ {! r answer to question 46
0 ^( k* b+ b7 f' ~. @8 n. X/ J7 M --------------------------------------------------------------------------------$ z! k7 L) k. c# n5 G+ C
question 47)/ ~9 Y8 g5 ?' v( p
which of the following will successfully create an instance of the vector class and add an element?$ L8 V0 o6 k# u
1) vector v=new vector(99); , k4 y% H$ {# C5 `) W
7 U% r+ Y9 s1 s0 ?7 L5 @ v[1]=99; |