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.
- Today's Bench Basics activity: Look It Up. It opens later in class and lives on slide 4 of this deck.
- 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.
Look It Up: The Java Quick Reference
This reading explains how to answer a question about a Java method by looking it up in the Java Quick Reference.
Reading an Entry
On the AP Computer Science A exam, every student gets the Java Quick Reference, a list of Java methods that may appear on the exam with a short explanation of each one. In Bench Basics, the Reference button opens the same list beside the code, so practice on the bench matches the conditions of the exam. Each entry starts with a line such as `static double pow(double base, double exponent)`. The word just before the name, `double`, is the return type, which is the type of value that comes back. The name is `pow`, and the parentheses show what goes in, which here is two `double` values. The return type explains why `Math.pow(2, 3)` prints `8.0` and not `8`, since a `double` value prints with a decimal point even when it is a whole number.
Today's five entries are `Math.abs`, `Math.pow`, `Math.sqrt`, and the String methods `length()` and `indexOf(String str)`. The method `Math.abs` returns the absolute value, which is a number's distance from 0, and it has one entry for an `int` and one for a `double`. The method `Math.sqrt` returns the square root as a `double`, and the method `length()` returns the number of characters in a String. The method `indexOf` returns the index of the first match, counting from 0, or `-1` when there is no match.
One Worked Example
The snippet below uses all five entries, and its output was copied from a real run.
1int a = -7; 2System.out.println(Math.abs(a)); 3System.out.println(Math.pow(2, 3)); 4System.out.println(Math.sqrt(49)); 5String place = "Bayou"; 6System.out.println(place.length()); 7System.out.println(place.indexOf("o")); 8System.out.println(place.indexOf("x"));
7 8.0 7.0 5 3 -1
The table below gives each line that prints, the Quick Reference entry it uses and what it prints.
Line | Quick Reference entry | Printed 2 | static int abs(int x) | 7 3 | static double pow(double base, double exponent) | 8.0 4 | static double sqrt(double x) | 7.0 6 | int length() | 5 7 | int indexOf(String str) | 3 8 | int indexOf(String str) | -1
Line 2 prints `7` with no decimal point, because `a` is an `int` and the `int` entry for `abs` returns an `int`. Lines 3 and 4 print `8.0` and `7.0`, because `pow` and `sqrt` return a `double`. Line 6 prints `5`, because "Bayou" has five characters. In line 7, which searches for the first lowercase o, B is at index 0, a is at 1, y is at 2 and o is at 3, so `indexOf("o")` returns `3`. Line 8 prints `-1`, because the String "Bayou" contains no x anywhere, and the Quick Reference says that `indexOf` returns `-1` if the text is not found.
What the Bench Checks
In today's bench, B23 Look It Up, a student opens the Reference, finds the method and types what is printed. The bench catches two common mistakes, and the first is writing `8` where the return type is `double`. The second is counting `indexOf` from 1, which gives `4` for the o in "Bayou" instead of `3`.
Sources: College Board, AP Computer Science A Java Quick Reference (2025); classroom data, B23 Look It Up and the snippet run with Java 21 (2026).
Open Source, Licenses and Intellectual Property
This section explains who owns code, how an owner gives permission to use it, and how the same questions apply to code an AI tool generates.
Code Is Someone's Work
The Java that checks every snippet in Bench Basics is a free download from Eclipse Adoptium, and the download includes the source code of Java's own classes. Anyone may reuse that code because its authors published it with written terms, which sit in a folder named legal inside the download. Intellectual property is a creation of the mind that the law treats as someone's property, such as an invention, a book, a song or a computer program. The Chromebook a program runs on is ordinary property, because it is a physical object. The program itself is intellectual property, because it is written work that a person created. In the United States, copyright protects an original work, including a computer program, as soon as the author writes it down, with no form to fill out. The owner then decides who may copy the work, change it and share it.
Licenses and Open Source
A license is the owner's written permission to use a work, together with the conditions that come with it. It states what other people may do with the code and what they must do in return. A license is not a price tag, because a free license still has conditions. For example, the MIT License lets anyone use, copy, change, share and even sell the code, free of charge. Its one condition is that the copyright notice and the license text stay with every copy of the code or of any large part of it.
Open source code is source code published under a license that lets anyone use it, change it and share it, including changed versions. The Open Source Initiative's official definition states that open source "doesn't just mean access to the source code." Code that a person can see on a website is not open source just because it is visible. The AP Computer Science A course description states that programmers often reuse code published as open source. It adds that code not published as open source can go into a program only after the programmer gets permission, which often means buying the code.
The class's own Java has an open source license. Its LICENSE file is the GNU General Public License, version 2, often called the GPL. The GPL asks more than the MIT License does, because anyone who shares a changed version must share its source code under the same license. The end of the same file adds the Classpath Exception, which lets a program that only uses this Java be shared under terms its own author chooses. Figure 1 shows the path a programmer follows to decide whether found code may be used.
Code Without a License and Code from an AI Tool
Seeing code is not the same as having permission to use it. GitHub's guide to choosing a license explains that code is under the author's exclusive copyright by default. When code has no license, other people generally have no permission to use, change or share it, so the guide suggests asking the author to add one.
Code from an AI tool needs the same check, because a model generates code by predicting what is likely to come next from its training. GitHub states that its Copilot tool was trained on code from public sources, including public repositories on GitHub. GitHub's documentation says that, while the chance is low, a suggestion can match code in the training set. The tool can also check suggestions against public code on GitHub and either block a match or show its source and license.
Who owns generated code is still being decided. In January 2025, the United States Copyright Office concluded that copyright does not protect material generated entirely by AI. With the tools available then, it also found that writing a prompt alone does not make a person the author. The Office said that it decides case by case whether a person added enough of their own work. In a class, the class's rule decides whether AI-generated code may be used, and a student names where any code came from. Before reusing any code, a programmer checks where it came from, whether it has a license and what that license asks. If the code is not open source, the programmer also needs the owner's permission.
Summary
Code is intellectual property, so in the United States its author owns it from the moment it is written down. A license gives permission with conditions, and open source code has a license that lets anyone use, change and share it. Code with no license, code that is not open source and code from an AI tool all need the same check of where it came from and what permission it carries.
Sources: College Board, AP CSA Course Description (2025); Open Source Initiative, Open Source Definition (2007) and MIT License (n.d.); GitHub, No License (n.d.); U.S. Copyright Office, What is Copyright? (n.d.) and Copyright and AI, Part 2 (2025); WIPO, What is IP? (n.d.); GitHub, Copilot docs and FAQ (n.d.); Adoptium, FAQ (n.d.); course JDK legal folder (2026).
The classwork form is not linked yet. Use Station View and write your answers in your lab notebook with the item labels.
MC 1. According to the passage, what makes code open source?
- Anyone can see its source code on a public website.
- It is published under a license that lets anyone use it, change it and share it.
- It has no license, so no one owns it and anyone may copy it.
- It is free to download, so it comes with no conditions at all.
MC 2. What does the MIT License allow, and what is its one condition?
- Anyone may use the code for free, as long as they never change it.
- Anyone may use the code after paying the author, with no other condition.
- Anyone may use, copy, change, share and sell the code, as long as the copyright notice and license text stay with it.
- Anyone may use the code, as long as they share their own program's source code under the same license.
MC 3. A student finds Java code on a web page, and the page has no license anywhere. What does the passage say about that code?
- It is free to copy, because the author posted it where anyone can see it.
- It is open source, because its source code is shown on the page.
- It belongs to no one, because the author never filled out a copyright form.
- It stays under the author's copyright, so the student would need to ask the author for permission.
MC 4. An AI tool generates a method for a student's program. Which is the best first step before using it, according to the passage?
- Check where the code came from and what the class rule says about AI code, and name the tool as its source.
- Use it freely, because no person wrote it, so no one can own it.
- Delete it, because AI tools always copy their code from someone else.
- Write the prompt again, because writing the prompt makes the student the code's author.
MC 5. Use the Java Quick Reference. What is printed?
1System.out.println(Math.abs(3 - 10));
- -7
- 7
- 7.0
- 13
MC 6. The line below prints 9.0, not 9. Which reason comes from the Java Quick Reference?
1System.out.println(Math.pow(3, 2));
- The answer, 3 squared, is not a whole number.
- The println method adds .0 to the end of every number it prints.
- The entry for pow says it returns a double, and a double prints with a decimal point.
- The pow method multiplies 3 by 2, then turns the answer into text.
MC 7. Use the Java Quick Reference. What is printed?
1System.out.println(Math.sqrt(16) + 1);
- 5
- 4.0
- 5.0
- 9.0
MC 8. A program needs the position where "z" first appears in a String named city. Which Quick Reference entry answers that question?
- int length()
- int indexOf(String str)
- static int abs(int x)
- static double sqrt(double x)
MC 9. Use the Java Quick Reference. What is printed?
1String street = "Magazine"; 2System.out.println(street.length());
- 7
- 8
- 9
- Magazine
MC 10. Use the Java Quick Reference. What is printed?
1String city = "Algiers"; 2System.out.println(city.indexOf("z"));
- 0
- 7
- an error message
- -1
CR 1. Use the Java Quick Reference. For each of the three lines below, write what it prints and name the return type that explains it.
1System.out.println(Math.abs(3 - 10)); 2System.out.println(Math.pow(3, 2)); 3System.out.println(Math.sqrt(16) + 1);
Write your answer in your lab notebook, labeled CR 1.
CR 2. Explain in two sentences what a license is and why code with no license is not free to copy. Use one fact from the passage.
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. Use the Java Quick Reference. Give what each of the four lines below prints, and explain the result of the last line.
1String dish = "Gumbo"; 2System.out.println(dish.length()); 3System.out.println(dish.indexOf("m")); 4System.out.println(dish.indexOf("b")); 5System.out.println(dish.indexOf("B"));
Write your answer in your lab notebook, labeled CR 3.
CR 4. An AI tool gives you 40 lines of Java for a club's attendance program. Name one thing you would check about whether it works and one thing you would check about whether you may use it. Explain each in a sentence.
Write your answer in your lab notebook, labeled CR 4.
Look It Up
Open the bench, do its six jobs, then paste your credit code into the credit-code form. You can turn in up to three codes per bench; your best score is your grade.
Bench Basics opens during your class period.
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.