AP Computer Science Assignments

Learn Java Programming
Supplemental, free, online textbook called Introduction to Programming Using Java
Java Cheat Sheet
Classes, Objects, & Constructors
AP Quick Reference Guide
Online Java Compiler
Java Examples
Arithmetic Operators
Digital Textbook
Visualize Java code execution

Apr 2

In this lesson, you will learn about arithmetic calculations in Java. There are 4 coding exercises.



Save your files in a folder called U1_L4. You will turn in your programs and a screenshot of the output to our Google Classroom.



Apr 1

Escape Room

You are going to make an escape room game. Download the Escape Room zip file to your java folder, open it and it will become your EscapeRoom Folder. Write the Escape Room code and save it in the EscapeRoom folder, javac it, and run it. Play the game, Make some screen shots and put them on a Google Doc. You will turn in EscapeRoom java file and a screenshot of the output to our Google Classroom





Save your files in a folder called EscapeRoom. You will turn in your programs and a screenshot of the output to our Google Classroom.



Mar 31

Let Them Eat Cake. Part 2

We'll continue the cake theme, but these must go into a folder called Cake2. Some of them have the same name as other files you have written, but they do different things, so they must be in a seperate folder.





Save your files in a folder called Cake2. You will turn in your programs and a screenshot of the output to our Google Classroom.



Mar 27

Let Them Eat Cake

Origami Cake

To further explore the difference between a class (a design) and an object (the instance), you will create a cake by following a recipe, but not a flour and egg cake, an origami cake. As you create your cake, think about how you are instantiating a cake from the instructions. Let's try an Origami Cake!







Now type these 4 programs, compile and run them, and screenshot the results. Save them in a folder called Cake.You will only be able to run the CakeRunner files, as the othes are just classes that the CakeRunner files use, but javac all but the origamiCake file.



Save your files in a folder called Cake. You will turn in your programs and a screenshot of the output to our Google Classroom.



Mar 26

This lesson introduces new data types, spends more time with variables, and teaches how to store numbers instead of Strings.



Data Types Video



Now type these 3 programs, compile and run them, and screenshot the results.

Save your files in a folder called DataTypes. You will turn in your programs and a screenshot of the output to our Google Classroom.



Mar 24

Getting started with java. You will first need to create a folder inside your documents folder called java and then another folder called inside the java folder. Next, open Terminal and a new document and type in the following code:



The name of the java file must match the class name. When saving the file, save it using the class name and add .java to the end of the filename.

Save your file as HelloWorld.java in your HelloWorld folder

type in cd Documents/java/HelloWorld

Now type ls

You should see your HelloWorld.java file

Every line of code that runs in Java must be inside a class. In our example, we named the class HelloWorld. A class should always start with an uppercase first letter.

Note: Java is case-sensitive: MyClass and myclass have different meanings.

The main Method

The main method is required and you will see this in every Java program:

public static void main (String[] args)

Any code inside the main method will be executed.

Java files need to be compiled before they will run, so type in javac HelloWorld.java

If there are no errors, you should see this



Next, type java HelloWorld

You should see this



You've just created your first java program!

System.out.println()

The println() method, short for "print line", is used to print a value to the screen and then adds a line break. print() also prints whatever is inside the () to the screen but does not add a line break.

You should note that the contents of the () are also in " " . This means that what is inside the quotes will print exactly to the screen.

This is called String literal, and we will see that we can put other things inside the () that will do math, call functions and more.

Each code statement must end with a semicolon ;

The /* and // signify comments. This is code that does not run, but it lets others who read your code know what you had in mind when you wrote it.

The curly braces {} mark the beginning and the end of a block of code and they always come in pairs.


Now do the same with these 3 programs



You will turn in your programs and a screenshot of the output to our Google Classroom.



Open your Documents folder and create a new folder called java. You will be making a new folder for every assignment. You will need get into that folder to compile a run your files. Open your text editing program and pin it to the dock or taskbar. Open the terminal and pin it to the dock or taskbar. Open Chrome and pin it to the dock or taskbar.


What is Java?

Java is a popular programming language, created in 1995.

It is owned by Oracle, and more than 3 billion devices run Java.

It is used for:


Why Use Java?


What is Java technology and why do I need it?

Java is a programming language and computing platform first released by Sun Microsystems in 1995. It has evolved from humble beginnings to power a large share of today’s digital world, by providing the reliable platform upon which many services and applications are built. New, innovative products and digital services designed for the future continue to rely on Java, as well.

While most modern Java applications combine the Java runtime and application together, there are still many applications and even some websites that will not function unless you have a desktop Java installed. Java.com, this website, is intended for consumers who may still require Java for their desktop applications – specifically applications targeting Java 8. Developers as well as users that would like to learn Java programming should visit the dev.java website instead and business users should visit oracle.com/java for more information.


Top 10 Reasons to Learn Java in 2025

You will turn in your programs and a screenshot of the output to our Google Classroom.

Click here for the course syllabus. Save it in your Documents folder.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.