Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Lesson 2.1 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