Java String Add Char Code Example

Snippet 1
  char ch='A';
String str="pple";
str= ch+str;   // str will change to "Apple" 
Snippet 2
  StringBuilder sbf = new StringBuilder("Welcome geeks!"); 
System.out.println( sbf); //will print "Welcome geeks!"

sbf.append('T'); 
System.out.println( sbf); //will print "Welcome geeks!T" 

Similar Snippets


Creating Java Main Method Code Example - java

Find Duplicates In Arraylist Java Code Example - java

Java Creat A Folder Code Example - java

Firestore Find Doc And Set Data Code Example - java

Create Copy Of Array From Another Array Code Example - java