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!"

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

Copyright © Code Fetcher 2020




Leave a comment

Your email address will not be published. Required fields are marked *