Overview


Java provides the "println" method to print a String to the console. We call it like this:

System.out.println("My String");



Examples


Here are several examples of using "println".

Note that in each case the resulting value sent to the "println" method is a String. See String Concatenation...

int width = 10;

Rectangle rec = getRec1();

System.out.println("My String");

System.out.println("Width: " + width);

System.out.println("Width: " + rec.getWidth());