Suppose I executed the following Java method:
public static void print() {
System.out.print("This is some text");
System.out.println();
}
How many lines of output are printed? What counts as a “line of output”? I would think there are two, but I really don’t know.
There will be one line of output printed because
System.out.print("This is some text")does not automatically move the cursor to a new line, butSystem.out.println()without arguments simply prints a new line, so the overall effect is the same as that ofSystem.out.println("This is some text"), i.e. one line of output.You can read more about this by looking at the documentation for the
PrintStreamclass.