Java Programming - Java.lang Class - Discussion
Discussion Forum : Java.lang Class - Finding the output (Q.No. 23)
23.
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);
Answer: Option
Explanation:
In line 4 the code calls a StringBuffer method, append() on a String object.
Discussion:
1 comments Page 1 of 1.
Irshad said:
6 years ago
When you append string with "Woo" it calls StringBuilder class and here we not initialize the StringBuilder object.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers