The print () function in Python and the System.out.print () function in Java all have the function of printing strings.
In Python:
Print ("hello,world!")
The output is: hello,world!
In Java:
System.out.print ("hello,world!");
The output is: hello,world!
As we can see, the use of these two functions is the same
The print () function also has this usage:
Print ("1+1=", + +)
The output is: 1+1= 2
In the same way, Java also has:
System.out.print ("1+1=" + (+));
The output is: 1+1=2
We found that when using the print () function, we used a "," to connect the results of the "1+1=" with the result of the ",", which is the function of the connection. At the same time, when using the System.out.print () function, we used a "+" to the "1+1=" and the results of the result connected together, this "+" also plays a role in the connection
We'll see what they have. Output, print () output is 1+1= 2, "=" and "2" there is a space between, and System.out.print () output is 1+1=2, "=" and "2" there is no space between. Here we find that the "," in the print () function in Python not only acts as a connection string, but also represents a space
Summarize:
The role of the print () function in 1.python is the same as the System.out.print () function in Java
The "+" in the 2.print () function "," and the System.out.print () function have the function of a connection string
The 3.print () function "," also represents a space
4. Different languages have a lot of similarities, different languages have different new features
The "," of the print () function in Python and the "+" in the System.out.print () function in Java