Please enable JavaScript to use CodeHS

Nevada Computer Science 2

Lesson 4.2 Printing in Java

Description

This lesson discusses printing a message in Java. Instead of extending Karel, students will now extend Console Program to print to the Console.

public class Welcome extends ConsoleProgram
{
    public void run()
    {
      System.out.println("*insert message here* "); 
      System.out.println("*insert message here* "); 
    } 
}

Objective

Students will be able to:

  • call system class methods to generate output to the console
  • recognize the difference between display behavior of System.out.print and System.out.println
  • create string literals