| Author |
system.out.print vs println
|
Brandi Love
Ranch Hand
Joined: Sep 19, 2003
Posts: 133
|
|
|
What is the difference between the print and println commands?
|
 |
S. Stacey
Greenhorn
Joined: Jul 03, 2003
Posts: 20
|
|
|
System.out.println will print on a new line where System.out.print will print and the same line.
|
 |
Jeff Bosch
Ranch Hand
Joined: Jul 30, 2003
Posts: 804
|
|
System.out.println will print on a new line where System.out.print will print and the same line.
Println() won't print on a new line, it will terminate the current line with a newline character or sequence. In other words, println() will print an end-of-line character, while print() will not. If you invoke println() after a print(), the argument to println() will append to the argument to print(). Here's an example: Running this snippet in a program produces Jeff Bosch on one line, then places the cursor at the beginning of the next line.
|
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: system.out.print vs println
|
|
|