首页 > 文档 > + (addition) 加法
2017
07-21

+ (addition) 加法

名称:+ (addition)

 

例子:

int a = 50 + 5;  // Sets 'a' to 55
int b = a + 5;   // Sets 'b' to 60

String s1 = "Chernenko";
String s2 = "Brezhnev";
String sc1 = s1 + s2;
String sc2 = s1 + ", Andropov, " + s2;
println(sc1);  // Prints "ChernenkoBrezhnev"
println(sc2);  // Prints "Chernenko, Andropov, Brezhnev"

String s1 = "Gorbachev";
int i = 1987;
String sc1 = s1 + i;
println(sc1);  // Prints "Gorbachev1987"

 

描述:

Adds two values or concatenates string values. As a mathematical operator, it calculates the sum of two values. As a string operator, it combines two strings into one and converts from primitive datatypes into the String datatype if necessary.

两个值相加或连接字符串值。 作为数学运算符,它计算两个值的和。 作为字符串运算符,它可以将两个字符串组合成一个。如果需要,它也能将其从原始数据类型转换为String数据类型。

 

语法:

value1 + value2

 

参数:

value1 String, int, float, char, byte, boolean
value2 String, int, float, char, byte, boolean

 

相关:

++ (increment)
+= (add assign)
– (minus)



最后编辑:
作者:Hewes
这个作者貌似有点懒,什么都没有留下。

+ (addition) 加法》有 1 条评论

  1. Pingback 引用通告: * (multiply) 乘 | Processing编程艺术

留下一个回复

你的email不会被公开。