1 of 52

Advanced Placement�Computer Science A�(Java)

Mr. (Raymond) Chan

Lowell High School

San Francisco, CA

Welcome!

Find your assigned seat.

“Last Name, First Name Initial”

1

2 of 52

Agenda

  1. Do Now
  2. Course Logistics
  3. [CW] Contact Survey, Piazza

Do Now

Welcome to AP CS A!

Browse apcslowell.github.io

Monday

August 18

(08.18)

Learning Target

Students will familiarize themselves with the class routines and get comfortable sharing their ideas.

3 of 52

This classroom is nut free

3

4 of 52

AP Computer Science A (Java) is an advanced computer science course equivalent to a first semester college class such as 111B Programming Fundamentals: Java at City College

Course Prerequisite: B or better in APCS Principles or Computer Programming A or equivalent

Not sure if you have met the prerequisite? Ask you instructor!

4

5 of 52

Equivalent to a half a semester of an introductory CS course, depends on the college

Course Requirements:

    • Prior programming experience (Principles, CPA/B, self study)
    • Use of Google Classroom and Synergy
    • A Git Hub account to share your programs on the web

5

6 of 52

Norms

  • Stay home if you are not feeling well
  • Respect others privacy and personal space
  • Minimize eating or drinking in the classroom
  • Wash your hands throughout the day
  • Let me know if you need to leave the room
  • Always sit in your assigned seat
  • Not required, but feel free to wipe down the keyboard, mouse and desk
  • Dress warm, we’ll keep the windows and door open to promote ventilation

6

7 of 52

Lowell has a mouse problem

  • You are welcome to eat in class, but. . .
  • Please do not through away food or wrappers in the classroom
  • Use the composting bins in the hallway

7

8 of 52

What you’ll learn

  • Advanced Java Programming
  • Object Oriented Programming including inheritance
  • How to make and maintain your own website
  • How to write (a little) HTML & CSS
  • How to use Git Hub
  • Searching and sorting
  • Recursion
  • Good Programming Style
  • All APCS A topics and a good foundation for studying computer science in college
  • + Fun stuff like Asteroids that isn’t on the AP exam that they don't teach you in college!

8

9 of 52

  • The complete course is online at GitHub
  • We’ll start at the top and work our way to the bottom

You are here

9

10 of 52

Grading Policy

  • Grades are cumulative and point based
  • Points will be assigned for

tests and quizzes

programming assignments

weekly reflections

  • All students are expect to take the AP CS A Exam is the afternoon of Friday, May 15, 2026

10

11 of 52

Professionalism

  • How you conduct yourself during your work
  • Includes (but not limited to)
    • Phone and Computer etiquette
    • Reliability and accountability
    • Ethics
    • Working cooperatively and respectfully with your peers and teachers

11

12 of 52

Weekly Reflections

  • Answering the following questions:
    • What did you learn the past few days?
    • What did you accomplish the past few days?
    • What mistake(s) did you make?
    • What questions do you have?
    • What do you want to learn more about?

12

13 of 52

Weekly Reflections

  • Good Example

“Monday: Today I went over three practice questions and got most of them correct. I want to learn more about coding different shapes besides the ellipse, square, and triangle. Tuesday: Today I went over another practice quiz question and I answered it correctly. I found out that the mistake I made with one of the questions yesterday was I said that capitalization doesn't matter in code,when it actually does. Wednesday: Today I made a simple pen picture on code pen following the directions from the slides. However, I might've made a mistake with my animal project, because the background wouldn't show up even though I changed the color. Thursday: The mistake I made yesterday was that I forgot to add the p5.js library to my settings. Today I decided what animal I want to do but I couldn't get anything to show up on codepen besides the background. Friday: Today I finished my first programming quiz in around 20 minutes. I'm unsure about two or three answers that I chose, but overall I feel pretty good about the test.“

13

14 of 52

Weekly Reflections

  • Bad Example (I appreciate honesty tho)

“I learned nothing. I also learned very little more. I accomplished nothing. I accomplished very little else.“

“October 21-25 I'd either slept, on my phone watching YouTube videos, or did work for other classes which I didn't even finish or turn in (ik I'm smart :)). Since I didn't pay attention to any of last week's lectures and let my chromebook sleep for most of the class, I didn't conplete this Dice Game assignment nor any previous unfinished assignments.”

“...Tuesday - I had a good breakfast, good day. Had some knowledgable moments in Physics. Wednesday - Learned how to eat properly again. Ate an apple from top to bottom… Friday: Found myself reminiscing whether to spoil Endgame for myself. Ended up not, going to watch it later tonight.”

  • These students got half credit.

14

15 of 52

Restroom policy

  • Please ask!
  • I need to know where you are
  • Please do not leave the room during a quiz
  • Sign on the clipboard by the door

15

16 of 52

  • Go to apcslowell.github.io and click the links to:
    • Enter your contact info (you must sign in with your SFUSD username)
    • Sign up for Piazza (It says Fall 2025)
      • Join code apcsa

  • While you are doing all that, I’ll take roll
  • Extra time? Browse apcslowell.github.io
  • Any questions?

16

17 of 52

  • Go to apcslowell.github.io and click the links to:
    • Enter your contact info (you must sign in with your SFUSD username)
    • Sign up for Piazza
      • Join code apcsa

  • While you are doing all that, I’ll take roll
  • Extra time? Browse apcslowell.github.io
  • Stuck? Consult next few slides
  • Any questions?

17

18 of 52

  • Sign up for Piazza

  • http://piazza.com/lowell_high_school/fall2025/apcsa
    • access code is apcsa
    • when asked to join the “Piazza Network”, skip it.
    • Click on the gear to change your email settings to your liking. Previous students disliked numerous emails they got.

  • All 2 sections of AP CS A will using Piazza
  • Post your questions there
    • You can respond and help each other here
    • Send emails to your teacher for personal matters

18

19 of 52

  • Sign up for CSAwesome - SPOT THE DIFFERENCE

19

20 of 52

  • Sign up for CSAwesome - SPOT THE DIFFERENCE

20

21 of 52

  • Sign up for CSAwesome - SPOT THE DIFFERENCE
  • Make sure you are signed in and in the correct course, ie “Lowell-CHAN-2020-21”

  • This ensures your progress is saved, so when I decided to grade your work, you will get points.

21

22 of 52

Submitting your GitHub URL

  • Sign in to GitHub and go to your profile

  • Copy the URL of your profile

  • Sign in to Google Classroom and find the Sign up for GitHub.com assignment. Choose Add | Link to submit the link to Google classroom

22

23 of 52

Proceed with some caution.

Slides from this point forward are not updated for the 2022-23 year.

23

24 of 52

Agenda

  • Do Now
  • First Java Program & Expressions
  • Four 4’s
  • [HW] CSAwesome Unit 1, Reflection

Do Now

How was the first day of school? (type in chat)

I have 66 (-3 b/c I signed up 3 times) students in my section of CSAwesome. Sign up!

Questions? Put into zoom chat.

Wednesday

August 19

(08.19)

Learning Target

Students will familiarize themselves with the class routines and get comfortable sharing their ideas.

25 of 52

Tutoring

  • Office Hours/Tutoring Times:
    • Mr. Simon can tutor students before school between 8 and 9 am, during blocks 3, 5, 7, 8 and after school between 2:10 and 2:40 pm.
    • Mr. Chan can tutor any APCSA Java students during blocks 2, 3, 5, 8 and evenings 8-9pm
  • Peer tutoring through CSF:
    • appointments can be schedule at lowellcsf.weebly.com
    • drop in tutoring in the library every school day from Block 1 to 4:45 PM after school
  • Lowell’s after school computer science clubs:
    • Girls Who Code
    • Dev (App Development) club
    • EECS (Electrical Engineering and Computer Science)

25

26 of 52

Java Basics

  • The common building blocks in programming languages are:
    • Variables
    • Loops
    • if statements
    • Functions (aka “methods”)
  • It’s expected that you have done programming with these already in some language
  • Over the next two weeks we’ll go over how these work in Java

26

27 of 52

A basic Java “Hello World” program

  • Click on the link to the “Four 4s Challenge” of just go to apcslowell.github.io/APJavaBasics/
  • It might look complicated at first, but . . .

27

28 of 52

A basic Java program

  • It turns out that this line is much more important than the others
  • So we can ignore everything except the code circled in green

28

29 of 52

Statements

  • The circled code is an example of a statement
  • It’s like an English sentence
  • A semi-colon marks the end of a Java statement

29

30 of 52

String

  • "Hello World!" is a Java String
  • A String is a collection of letters, digits, punctuation and/or spaces
  • The beginning and end of the String are marked with double quotes (")

30

31 of 52

print() vs println()

  • System.out.println() prints first and then goes to the next line

31

32 of 52

print() vs println()

  • System.out.print() prints, but it does NOT go to the next line
  • If we change the first statement to System.out.print() "Bottom" is printed on the same line as "Top"

32

33 of 52

print() vs println()

  • Changing the second statement to System.out.print() doesn’t change the output since nothing is printed after "Bottom"

33

34 of 52

Comments

  • Lines that begins with two slashes // are ignored by Java

  • Comments have no effect on the execution of the program, but they make it easier for other programmers (and your future self) to understand what you meant to do

34

35 of 52

Escape Sequences

  • Special characters
  • In Java, Escape Sequences begin with a backslash \
  • A good way to remember the difference between a backslash and a forward slash is that a backslash leans backwards ( \ ), while a forward slash leans forward ( / )

35

36 of 52

Common Java Escape Sequences

  • \n Insert a newline in the text at this point

36

37 of 52

Common Java Escape Sequences

  • \t Insert a tab in the text at this point

37

38 of 52

Common Java Escape Sequences

  • \' Insert a single quote character
  • \" Insert a double quote character
  • \\ Insert a backslash character

38

39 of 52

Formatting Java code

  • In Java programs, some spaces are required
  • For example, you need at least one space between keywords
  • The program below is not legal

39

40 of 52

Formatting Java code

  • But most other spaces are optional
  • For example, this program is legal but hard to read

40

41 of 52

Formatting for easier reading

  • The blank space (also called “white space”) commonly used to format code is:
    • Indentation inside of { }
    • One statement per line

41

42 of 52

Debugging

  • Errors in programs are called “bugs”
  • The process of fixing program errors is called “debugging”
  • It’s good to work around other programmers when you are learning a new programming language
  • Asking for help with debugging is a part of learning

42

43 of 52

Errors

  • When you write Java programs you will often get an error message
  • When you are learning a new programming language, errors are a fact of life
  • Errors are ok, just fix them and move on

43

44 of 52

Syntax error

  • In this case I made a syntax error
  • Syntax is the grammar and spelling of a computer language
  • Here I forgot the double quotes around my name

44

45 of 52

Logic error

  • This time I misspelled my name
  • The computer doesn’t know my name, so the program runs incorrectly without an error message

45

46 of 52

(Run time) Exceptions

  • Sometimes a logic error crashes the computer and stops the running program
  • Here I made the logic error of dividing by zero

46

47 of 52

Arithmetic in Java

+ - * /

  • Addition
  • Subtraction
  • Multiplication
  • Division

47

48 of 52

Literals vs. Expressions

  • Double quotes around text tells Java it is an expression
  • Java will print an expression exactly as written

48

49 of 52

Literals vs. Expressions

  • Here’s an expression "4/4"
  • Java prints it in exactly the same form

49

50 of 52

Literals vs. Expressions

  • Here’s an expression 4/4
  • Java evaluates it to get an answer 1
  • And then prints it

50

51 of 52

Four 4s challenge

  • Use exactly four 4's to write an expression that evaluates to every integer from 1 to 10, using only + - * / and ()
  • No decimals, factorials, square roots, exponents, etc.

51

52 of 52

Four 4s challenge

  • Print 10 expressions that use arithmetic and four 4s that evaluate to 1 through 10
  • Here’s one way to do the first

52