Terminal Output

Python Java
The print statement automatically converts data to text, displays it, and moves the cursor to the next line:

print(“Hello world!”)
print(34)

To prevent the output of a newline, use the optional end keyword argument with the empty string:

print(“Hello world!”, end = “”)

The method println, when run with the class variable System.out, converts data to text, displays it, and moves the cursor to the next line:

System.out.println(“Hello world!”);
System.out.println(34);

To prevent the output of a newline, use the method print:

System.out.print(“Hello world!”);

© Ken Lambert. All rights reserved.