Consider having three String variables a, b and c. The statement c = a + b; can also be achieved by doing


Consider having three String variables a, b and c. The statement c = a + b; can also be achieved by doing


a) c = a.length( ) + b.length( );

b) c = (int) a + (int) b;

c) c = a.concat(b);

d) c = b.concat(a);

e) c = a.plus(b);

Answer: c. The statement c = a + b uses the concatenation operator + (not to be confused with numeric addition). The same result can be achieved by passing a the concat message with b as the parameter. Answer d will set c to be b + a rather than a + b.