Web | This Site

Java Basics
Java Object Oriented
Java Advanced
Java Useful References
Java Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# Java - String Buffer reverse() Method

## Description:

This method reverses the value of the StringBuffer object that invoked the method.

Let n be the length of the old character sequence, the one contained in the string buffer just prior to execution of the reverse method. Then the character at index k in the new character sequence is equal to the character at index n-k-1 in the old character sequence.

## Syntax:

Here is the syntax for this method:

    public StringBuffer reverse()

## Parameters:

Here is the detail of parameters:

- NA

## Return Value :

- StringBuffer object with the reversed sequence.

## Example:

    public class Test{
        public static void main(String args[]){
           StringBuffer buffer = new String( " Game Plan");
           buffer.reverse();
           System.out.println(buffer);
       }
    }

This produces following result:

    nalP emaG

Advertisement

Online Image Processing

Indian Baby Names