JAVA(String Buffer and String Builder
package String;
public class StringTest {
public static void main(String[] args) {
/*
* Example of immutable string
* Immutable means unchangeable7
* Example of string buffer
*/
String s="I teach in ";
s.concat("Arniko school");
System.out.println(s);
//to solve this problem we have string builder
StringBuilder sb= new StringBuilder("I teach in ");
sb.append("Arniko school ");
System.out.println(sb);
}
}
Comments
Post a Comment