Question: What happens if you try to append a String to a StringBuffer if the resulting new string exceeds the capacity of the StringBuffer? An error

What happens if you try to append a String to a StringBuffer if the resulting new string exceeds the capacity of the StringBuffer?

An error results and the statement fails at run time.
An error results and the statement fails at compile time.
The StringBuffer automatically increases its capacity to store the longer string.
The statement compiles and runs but the string is truncated to fit into the StringBuffer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!