Monday, 29 June 2015

Reverse a String -StringBuffer

package com.JavaInterview.Programs;
/*
 * 
 */
import java.util.*;
public class RevString2 {

 public static void main(String args[])
 {
  StringBuffer s=new StringBuffer("JAVA");
  System.out.println("Reverse of string :"+s.reverse());
 }

}

Output :
AVAJ


No comments:

Post a Comment

Difference between final, finally and finalize()?

final :Final is a keyword. Final is used to apply restrictions on class, method and variable. Final class can't be inherited, final ...