What will be the result of attempting to compile and run the following program?
public class Main{ public static void main (String args [] ){ StringBuilder sb = new StringBuilder ("12345678"); sb .setLength (5); sb .setLength (10); System.out.println (sb .length ()); } }
Select 1 option
Correct Option is : B
If you do System.out.println (sb); it will indeed print 12345 but the length will be 10.