Java.lang Class

Q1: What will be the output of the program?
String d = 'bookkeeper';
d.substring(1,7);
d = 'w' + d;
d.append('woo');  /* Line 4 */
System.out.println(d);

A wookkeewoo

B wbookkeeper

C wbookkeewoo

D Compilation fails.

ANS:A - wookkeewoo

In line 4 the code calls a StringBuffer method, append() on a String object.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.