StringBuffer character sequence can be replaced by the reverse of the sequence with the help of reverse() method in java. reverse() function change the order of character sequence of string in StringBuffer. Use of String reverse() in java is shown below.
Example of StringBuffer reverse() in java, JSP
public class StringBufferReverseExample { public static void main(String[] args) { StringBuffer sb = new StringBuffer("Java StringBuffer reverse"); System.out.println("Output :"+sb); sb.reverse(); System.out.println("Output :"+sb); } }
Output
Output :Java StringBuffer reverse
Output :esrever reffuBgnirtS avaJ
Tags: String, StringBuffer



Link to Us