Calculating capacity

Report a typo

Enter the value of the currentCapacity variable after the following code is executed:

StringBuilder firstBuilder = new StringBuilder(10);
StringBuilder secondBuilder = new StringBuilder(8);
firstBuilder = secondBuilder;

firstBuilder
    .append("J")
    .append("a")
    .append("v")
    .append("a");

firstBuilder.deleteCharAt(0);

int currentCapacity = firstBuilder.capacity();
Enter a number
___

Create a free account to access the full topic