Groovy – Strings reverse()

  • Post author:
  • Post category:Groovy
  • Post comments:2 Comments
reverse

Creates a new String which is the reverse of this String.

Syntax

String reverse()

Parameters

None

Return Value

This method returns the resulting String.

Following is an example of the usage of this method −

class Example {
   static void main(String[] args) {
      String a = "Hello World";
      println(a.reverse());
   } 
}

When we run the above program, we will get the following result −

dlroW olleH

Previous Page:-Click Here

This Post Has 2 Comments

Leave a Reply