Software Sue

Link to Simply Sue
Link to Sustainability Sue
location: software/java/input & output Skip navigation : Home  

Java Input / Output


Under construction

Input

Output

println()

You can use the method println() to display text output. Put the required text within double quotes within the method's parentheses, for example:

System.out.println("Integer calculation program"); // Execute println() to output text

The method println() belongs to the object out, which is an instance variable of the class System. The object out is static, so it will exist even if there are no objects of type System in existence.

The method println() can be used for more than just one string of text, for example:

System.out.println("The total is " + tot); // Display the result

Here, the compiler interprets the + as an instruction to convert the value of 'tot' to a character string and then tack it on to the first string, to give "The total is 27" in the above example. You can combine more than two strings and values by using additional '+' signs.