Groovy - plus()



Appends a String

Syntax

String plus(Object value) 

Parameters

Value − The object to append to the string

Return Value

This method returns the resulting String.

Example

Following is an example of the usage of this method −

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

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

HelloWorld 
HelloWorld Again
groovy_strings.htm
Advertisements