✕ Close

Week 15 · 15.3 · Wed, Nov 11 · Do Now

Do Now

Work every question in your notebook. Do it on your Chromebook with your ID.

  1. One capital letter

    What happens when this program is run?

    public class Main
    {
        public static void main(String[] args)
        {
            System.out.println("Ready");
            System.out.Println("Set");
            System.out.println("Go");
        }
    }
    1. It does not run: Println with a capital P is not a name Java knows, so no line prints.
    2. It prints Ready, then stops at line 6.
    3. It prints Ready and Go and skips line 6.
    4. It prints all three lines.
  2. Every pair closed

    Only one of these lines compiles. Which one?

    1. System.out.println("Score: " + (4 + 5);
    2. System.out.println("Score: + (4 + 5));
    3. System.out.println("Score: " + (4 + 5));
    4. System.out.println("Score: " + (4 + 5))
  3. Find the bug

    This program should print the three lines in the expected column. It printed the lines in the printed column. The first line that differs is line 1. Which change fixes the program?

    public class Main
    {
        public static void main(String[] args)
        {
            System.out.println("Lights down");
            System.out.println("Doors open");
            System.out.println("Show starts");
        }
    }
    What the program should print, and what it printed
    lineexpectedprinted
    1Doors openLights down
    2Lights downDoors open
    3Show startsShow starts
    1. Swap lines 5 and 6.
    2. Change line 5 to print.
    3. Move main higher in the file.
    4. Add a semicolon to line 6.