Lesson 1.4b -
Basic Output There are two main ways that you will use the System.out statement, System.out.print and System.out.println (read this as print line) . Both of these statements display information in the same way. It's what they cause to happen after the display takes place is what makes them different. Let's see some examples. The code... System.out.print("Hello"); will produce the following output: HelloWorld but... will produce: Hello The difference between print and println is that println moves the cursor down to the next line after output, whereas the print statement stays on the same line after output. Typically we use print for prompt statements and println for other output. However, there will be other uses of print that will come up from time-to-time. For now, choose the right statement for the task at hand. |
|||||||||||
© DanShuster.com