« Back
package com.string; public class StringBuffers { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); System.out.println(sb.length()); System.out.println(sb.capacity()); sb.append("hello"); sb.append("coders"); sb.append("arts welcome in noida"); System.out.println(sb); System.out.println(sb.capacity()); sb.append("sec 63 G-69"); System.out.println(sb); System.out.println(sb.capacity()); StringBuffer sb1 = new StringBuffer("coder"); System.out.println(sb1.length()); System.out.println(sb1.capacity()); } }
0
16
hellocodersarts welcome in noida
34
hellocodersarts welcome in noidasec 63 G-69
70
5
21
×
Report a Problem:
Description:
Submit