OnJava8-Examples/operators/StringOperators.java
2015-05-29 14:18:51 -07:00

21 lines
526 B
Java

//: operators/StringOperators.java
// ©2015 MindView LLC: see Copyright.txt
import static net.mindview.util.Print.*;
public class StringOperators {
public static void main(String[] args) {
int x = 0, y = 1, z = 2;
String s = "x, y, z ";
print(s + x + y + z);
print(x + " " + s); // Converts x to a String
s += "(summed) = "; // Concatenation operator
print(s + (x + y + z));
print("" + x); // Shorthand for Integer.toString()
}
} /* Output:
x, y, z 012
0 x, y, z
x, y, z (summed) = 3
0
*///:~