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
Get step-by-step solutions from verified subject matter experts
