Groovy plus()方法
追加字符串
句法
String plus(Object value)
参数
Value - 要附加到字符串的对象
返回值
此方法返回生成的String。
例子
下面是一个使用这个方法的例子 -
class Example {
static void main(String[] args) {
String a = "Hello";
println(a.plus("World"));
println(a.plus("World Again"));
}
}
当我们运行上面的程序,我们将得到以下结果 -
HelloWorld HelloWorld Again