Implement the following procedure to observe the results
int x=100;
int y=200;
System.out.println ("x+y=" +x+y);
System.out.println (x+y+ "=x+y");
It turned out to be
Reason:
In Java, + is sometimes an operator, sometimes a connector
1) when both left and right connections are non-numeric, the connector.
2) is a connector when one side is a numeric type and the other is a non-numeric type.
3) When both sides are numeric types, the operator, that is, the function of the summation sum
System.out.println (str) itself outputs a string, and according to the precedence rules of the operator,
System.out.println ("x+y=" +x+y), the statement is the output string X (100) after the output string Y (200), so the output of the statement is x+y=100200;
and System.out.println (x+y+ "=x+y"), the statement is to first convert the string X and Y to Ascall code, and then add the output after the addition of the result of 300, so the output is 300=x+y.
is the + number an operator or a connector?