String Builder :
String Builder is often used if you want use string concatenation very often.
Time complexity will be O(N).
String Builder is often used if you want use string concatenation very often.
Time complexity will be O(N).
package com.techyield.operationsinarray;
public class StringBuilder {
public static void main(String[] args) {
int n = 10000;
StringBuilder str = new StringBuilder("Hello");
for(int i =0 ; i < n ; i++) {
str.append("satya");
}
String s = str.toString();
}
}
No comments:
Post a Comment