There are many situation where we need to reverse the string there are many methods to do this but these methods are very complex to apply StringBuffer provides simple method its shown below StringBuffer reverse()
CODING:
class reverse {
public static void main(String args[]) {
StringBuffer sb = new StringBuffer("fedcba"); System.out.println("Before Reverse : "+sb); sb.reverse(); System.out.println("After Reverse : "+sb);
} }
No comments:
Post a Comment