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

Popular posts from this blog

A simple method using string to check whether the input password is correct or not

Java Program any letter to upper case Letter(JavaSWING) ActionListener