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, place a comma at the end of the statement:

 

print "Hello world!",

 

 

 

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!");

 

 

Previous

Index

Next