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.
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"); } }- It does not run: Println with a capital P is not a name Java knows, so no line prints.
- It prints Ready, then stops at line 6.
- It prints Ready and Go and skips line 6.
- It prints all three lines.
Every pair closed
Only one of these lines compiles. Which one?
- System.out.println("Score: " + (4 + 5);
- System.out.println("Score: + (4 + 5));
- System.out.println("Score: " + (4 + 5));
- System.out.println("Score: " + (4 + 5))
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 line expected printed 1 Doors open Lights down 2 Lights down Doors open 3 Show starts Show starts - Swap lines 5 and 6.
- Change line 5 to print.
- Move main higher in the file.
- Add a semicolon to line 6.