Before the bell
You are responsible for all of this before the end of class.
- The discussion form in the I Do deck. All three sections. If you are here, this should be done.
- Your classwork. This form on the right. Section 1 before the exit ticket pops up; Section 2 past the floor.
- No Bench Basics today — this is a short or catch-up day.
- The exit ticket. It opens 15 minutes before the bell and lives on the last slide of this deck.
The classwork form is not linked yet. Use Station View and write your answers in your lab notebook with the item labels.
One Program, Four Skills
This reading makes four passes over one short Java program, one pass for each of this week's Bench Basics skills. The lines are counted from the top, so line 1 is `public class Main {` and line 11 is the last closing brace.
1public class Main { 2 // Friday: the shape, the order, printing and symbols. 3 public static void main(String[] args) { 4 System.out.print("Friday"); 5 System.out.println(" review"); 6 System.out.println("B09 to B12"); 7 System.out.println(); 8 System.out.print("Is 3 < 4? "); 9 System.out.println(3 < 4); 10 } 11}
Friday review B09 to B12 Is 3 < 4? true
The Shape and the Order
The first pass looks at the shape of the program. Line 1 names the class, `Main`, and its code sits between the opening brace on line 1 and the closing brace on line 11. Line 3 begins the method named `main`, and its block runs from the brace on line 3 to the brace on line 10. Lines 4 to 9 are the six statements, and each one ends with a semicolon. Every Java application must contain a `main` method with the header shown on line 3, because that method is where the application begins.
The second pass follows the order in which the lines run. A Java program starts in `main`, so nothing on lines 1 to 3 prints anything. Line 2 is a comment, because it begins with `//`, and the compiler ignores it, so it never runs. The six statements on lines 4 to 9 then run one at a time, from top to bottom, as steps 1 to 6. After line 9 runs, the program reaches the brace that closes `main` and stops.
Printing and Symbols
The third pass traces the output, one statement at a time. In the table below, `print` writes its text and keeps the line open, while `println` writes its text and then ends the line.
Line Statement Output on that line so far Ends the line?
4 System.out.print("Friday"); Friday no
5 System.out.println(" review"); Friday review yes
6 System.out.println("B09 to B12"); B09 to B12 yes
7 System.out.println(); (nothing) yes, an empty line
8 System.out.print("Is 3 < 4? "); Is 3 < 4? no
9 System.out.println(3 < 4); Is 3 < 4? true yes
Line 5 adds its text to the line that line 4 left open, which is why the space inside `" review"` matters. A new line begins only after a `println` runs, so the six statements print four lines of output, and the third of those lines is empty. Line 7 has nothing inside its parentheses, so it ends a line with no text on it, and that is the empty line in the output.
The fourth pass looks at the symbols. The `<` on line 8 sits inside quotation marks, so it is part of the text and prints exactly as written. The `<` on line 9 has no quotation marks around it, so Java compares the two numbers. The comparison `3 < 4` is true, because 3 is less than 4, and `println` prints the word `true`. The same symbol does a different job depending on whether it is inside quotes.
Sources: Oracle, The Java Tutorials, Getting Started (n.d.); Oracle, Expressions, Statements, and Blocks (n.d.); Oracle, Class PrintStream, Java SE 21 (n.d.); Oracle, The Java Language Specification, Java SE 21 (2023).
Testing a Change to Code Coach
This section explains how a builder can tell whether a change to a tool helped, using a real change to Code Coach's system prompt.
Test Inputs and Expected Outputs
Code Coach helps a student understand a short piece of Java while reading it. Its system prompt is the set of instructions the builder sends to the model with every request, and its five requirements each name one thing the tool must do. A test input is an input chosen before any testing, so that the same input can be given to the tool again after a change.
Code Coach has three test inputs, and each one checks a different requirement. The first is two lines of Java that print "Go" and "Saints," and it checks R1 and R2. The second is `int x = 7 / 2;` followed by printing `x`, and it checks R2, since real Java prints 3 for it because integer division drops the remainder.
1int x = 7 / 2; 2System.out.println(x);
3
The third is a sentence of plain English asking for help with an essay about the Louisiana Purchase, and it checks R4. A new question thought up after the change is not the same test input, so its output cannot be compared with the old one.
An expected output is what the tool should produce for a test input, written down from the requirements before the test is run. For the second test input, the expected output says that `x` stores 3 and that the program prints 3, and each run's real output was then recorded beside it. An output written down after the test is run is not an expected output, because its writer had already seen the answer.
Running Each Test Twice
A language model predicts each token from a set of probabilities, so the same input can produce different outputs. For this reason, each test input was run twice under each version of the system prompt, and both outputs count.
Under version 1, five of the six runs met their requirements, and the one failure came on the second test input, in the second run, which explained line 2 only as "This line prints the value of `x` to the console." It never said that `x` stores 3 or that the program prints 3, so R2 was not met. The first run on the same test input had ended with "This line prints the value of `x`, which is `3`, to the console." A builder who ran the test once could have seen that good answer and missed the failure.
One Change, the Same Test Inputs
The builder then changed one sentence, line 3 of the system prompt, to meet R2.
Version 1: Explain in plain words what the code does, one line at a time. Version 2: Explain in plain words what the code does, one line at a time, and for every line that prints or stores a value, say exactly what it prints or stores.
Next, the builder ran the same three test inputs, twice each, with version 2. All six runs met their requirements, and both runs on the second test input ended with "prints the value of `x`, which is `3`." Figure 1 lets a reader compare the outputs of the two versions, row by row.
A fair comparison changes one thing and keeps the test inputs the same. A biology textbook describes the same idea for experiments, where a control group has every feature of the experimental group except the one change being tested. When the same test inputs are run before and after a change, the builder can compare the outputs and credit any difference to the change.
Auditing Version 2
An audit is a check of a tool against every requirement, one at a time, in which each test is run and the result is recorded as "met" or "not met," with what happened. NASA's engineering handbook describes the same practice, where testing produces data for each requirement and each result is recorded as a pass or a fail. An audit tests each requirement and records whether it is met.
Code Coach's audit of version 2 recorded five results. R1 was met, because every run on the two Java test inputs explained only the lines it was given. R2 was met, because all four of those runs named what is printed or stored. R3 was met, because no run wrote new code or an essay. R4 was met, because both runs on the essay request said "I can only help with Java code." and asked for Java. R5 was met on the bench, which shows "Paste or pick a line first." when nothing is picked and sends no request, so no model is involved.
Trying the tool once and liking the answer is not an audit, because an audit checks every requirement and records each result. An audit also records the test that was run.
Summary
Test inputs and expected outputs are written before any test runs. The same test inputs, run more than once before and after one change, show whether the change helped, and an audit tests each requirement and records whether it is met.
Sources: Code Coach README and captures, mistral-small-2603 (2026); Mistral AI, Sampling (n.d.); Clark, Douglas and Choi, Biology 2e (2018); NASA, NASA Systems Engineering Handbook, 5.3 (2023); Oracle, The Java Language Specification, Java SE 21 (2023).
The classwork form is not linked yet. Use Station View and write your answers in your lab notebook with the item labels.
MC 1. After one sentence of Code Coach's system prompt was changed, the builder ran the same three test inputs again. Why the same three?
- So that a difference in the outputs comes from the change and not from a different question
- So that the model is sure to give exactly the same output on every run
- Because the class endpoint accepts only inputs it has already answered once
- Because brand-new test inputs would take much longer to run than old ones
MC 2. In Code Coach's test table (Figure 1), what is compared?
- The two system prompts, read side by side to see which one sounds clearer
- Version 2's outputs on new questions that were written after the change
- The outputs of the two versions on the same test inputs, each checked against its expected output
- The first run of each test input against its second run, and nothing else
MC 3. What does an audit record for each requirement?
- Whether the builder liked the answer the tool gave on its first try
- Only the requirements that were not met, because met ones need no record
- The tool's best answer, so that it can be shown to the people who use it
- The test that was run, whether the requirement was met, and what happened
MC 4. Why was the expected output for each of Code Coach's test inputs written down before the test was run?
- So that it came from the requirements, not from an answer the writer had already seen
- So that the model could read the expected output and give the same answer
- Because the expected output is the first answer the model gives to a test input
- So that the testing would finish faster on the day the tests were run
MC 5. Count the lines from the top, starting at 1. Which brace closes the method `main`?
1public class Tide { 2 public static void main(String[] args) { 3 System.out.println("High tide"); 4 } 5}
- The brace on line 5
- The brace on line 4
- The brace at the end of line 2
- The semicolon at the end of line 3
MC 6. Count the lines from the top, starting at 1. Which line runs first?
1public class Main { 2 public static void main(String[] args) { 3 // Print two streetcar stops. 4 System.out.println("Canal"); 5 System.out.println("Carrollton"); 6 } 7}
- Line 3
- Line 1
- Line 4
- Line 2
MC 7. How many lines of output does this code segment print?
1System.out.print("Red "); 2System.out.print("beans "); 3System.out.println("and rice"); 4System.out.println("Monday");
- 4
- 3
- 1
- 2
MC 8. What is printed?
1System.out.print("Second"); 2System.out.println("line");
- Secondline, all on one line
- Second line, on one line with a space between the words
- Second on the first line, then line on the next line
- line on the first line, then Second on the next line
MC 9. Which symbol ends the statement in this line of Java?
1System.out.println("Who dat");
- the closing brace }
- the semicolon ;
- the closing parenthesis )
- the quotation mark "
MC 10. What is printed?
1System.out.println(7 < 7);
- true
- 7 < 7
- false
- 0
CR 1. Count the lines from the top, starting at 1. (1) Name the class and the method where the program starts. (2) List the lines that run, in the order they run. (3) Write the exact output.
1public class Parade { 2 public static void main(String[] args) { 3 System.out.print("Throw me "); 4 System.out.println("something"); 5 } 6}
Write your answer in your lab notebook, labeled CR 1.
CR 2. In two sentences, explain why the same test inputs are run before and after a change. Use one fact from Code Coach's test.
Write your answer in your lab notebook, labeled CR 2.
The classwork form is not linked yet. Use Station View and write your answers in your lab notebook with the item labels.
CR 3. A school's homework-reminder text service has three requirements. R1: When a student texts HW, the service replies with the assignments due the next school day. R2: When a student texts STOP, the service sends no more messages to that number. R3: When a student texts a word it does not know, the service replies "Text HW for homework or STOP to end." Write a test input and an expected output for each requirement. Then write the audit table with four columns, requirement, test input, expected output and met?, and leave the met? column blank.
Write your answer in your lab notebook, labeled CR 3.
CR 4. A builder changed a tool's system prompt and its test inputs at the same time, and the outputs got better. Explain what the builder cannot tell, and what to do instead. Use one idea from the passage.
Write your answer in your lab notebook, labeled CR 4.
No bench today
There is no bench on this day. Finish your classwork and move to the exit ticket.
No bench today — the bench pop-up is off for this day.
The classwork form is not linked yet. Use Station View and write your answers in your lab notebook with the item labels.
This opens during your class period.