code a simple program to output text values like Hello and Goodbye
learning-point
code
use System.out.println( ) to display a text value you want to output
use "speech marks" to create a text value
development work
read a program requirement to understand what the the program should output or display
read a user interface design to see what the output should look like
introducing the code
here is the new code that will be featured
1 System.out.println();
2 System.out.println( "Hi" );
understanding the code
on line 1 the println command is shown, it is used to display output in the console
notice the capital S for System,
notice the dots between the words,
notice println is read as print line,
notice the (brackets),
notice the semi-colon; at the end of the line
this example on line 1 above will display a blank line because there is nothing inside the brackets, a blank line can be very useful!
on line 2 the println command will display the word "Hi", (the speech marks will not display)
The code above will produce this output in the console
Hi
println (print line) outputs whatever is within the brackets and then (invisibly) takes a newline
Taking a newline after output means that any follow-on output will begin on the line below the previous line.
In the example the first line is blank because the brackets were empty and then second line appears below the blank line.
develop the code
Now that we have been introduced to println, let’s go on to prepare and run some code! There are some notes to read below before you open the project in