Groovy - next()


Advertisements

This method is called by the ++ operator for the class String. It increments the last character in the given String.

Syntax

String next()

Parameters

None

Return Value

The new value of the string

Example

Following is an example of the usage of this method −

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

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

Hello World
groovy_strings.htm
Advertisements