In this lesson, students are introduced to CodeHS and how Karel the Dog can be given a set of instructions to perform a simple task.
Students will be able to:
Write their first Karel program by typing out all of the Karel commands with proper syntax
Explain how giving commands to a computer is like giving commands to a dog
In this lesson, students learn more about Karel and Karel’s world. Students learn about walls in Karel’s world, the directions Karel can face, and how to identify a location in Karel’s world using streets and avenues. In these exercises, students will begin to see the limitations of Karel’s commands. Students will need to apply Karel’s limited set of commands to new situations. For example, how can we make Karel turn right, even though Karel does not know a turnRight command? wocka wocka
Students will be able to:
This lesson introduces the run method, which is the place where the program starts running. Students will also learn to write full java programs instead of just writing commands. In the the program below, SquareKarel is the name of the class. When we say extend Karel, it means this is a Karel program like the ones we have already written.
public class SquareKarel extends Karel
{
public void run()
{
putBall();
move();
turnLeft();
}
Students will be able to:
In this lesson, students will learn how they can create their own commands for Karel by calling and defining methods. Methods allow programmers to create and reuse new commands that make code more readable and scalable.
Students will be able to:
turnRight()
methodIn this lesson, students learn in more detail about methods, and how they can use methods to break down their programs into smaller pieces and make them easier to understand.
Students will be able to:
In this lesson, students learn about Top Down Design and Decomposition. Top Down Design is the process of breaking down a big problem into smaller parts.
Students will be able to:
In this lesson, students learn how to style their programs by including comments. Comments allow students to leave notes on their program that makes it easier for other to read. Comments are written in plain English.
Commenting Your Code Example:
/*
* multi-line comments
*/
// single line comments
Students will be able to:
In this lesson, students are introduced to Super Karel! Since commands like turnRight()
and turnAround()
are so commonly used, students shouldn’t have to define them in every single program. This is where SuperKarel comes in. SuperKarel is just like Karel, except SuperKarel already knows how to turnRight and turnAround, so students don’t have to define those methods anymore. To use SuperKarel instead of Karel, the class that students write extends SuperKarel instead of Karel:
public class MyProgram extends SuperKarel
{
}
Students will be able to:
In this lesson. students learn how to use for loops in their programs. The for loop allows students to repeat a specific part of code a fixed number of times.
For loops are written like this:
for(int i = 0; i < 4; i++)
{
// Code to be repeated 4 times
}
Students will be able to:
In this lesson, students are introduced a new type of loop: while loops. While loops allow Karel to repeat code while a certain condition is true. While loops allow students to create general solutions to problems that will work on multiple Karel worlds, rather than just one.
Students will be able to…
In this lesson, students learn about the conditional statement “if”. Code within an “if statement” will only execute IF the condition is true.
if (frontIsClear()) {
// Code to be executed only if front is clear
}
Students will be able to:
In this lesson, students learn about an additional control structure, if/else statements. If/else statements let students do one thing if a condition is true, and something else otherwise.
if/else statements are written like this:
if(frontIsClear())
{
// code to execute if front is clear
}
else
{
// code to execute otherwise
}
Students will be able to:
In this lesson, students learn how to combine and incorporate the different control structures they’ve learned to create more complex programs.
Students will be able to:
In this lesson, students get extra practice with control structures. Students will continue to see different ways that the if, if/else, while, and for loops affect their code and what Karel can do.
Students will be able to:
In this lesson, students review how they should indent their code to make it easier to read.
Students will be able to:
In this lesson, students will synthesize all of the skills and concepts learned in the Karel unit to solve increasingly challenging Karel puzzles.
Students will be able to:
In this lesson, students complete a summative assessment of the unit’s learning objectives.
Students will be able to:
This lesson discusses printing a message in Java. Instead of extending Karel, students will now extend Console Program to print to the Console.
public class Welcome extends ConsoleProgram
{
public void run()
{
System.out.println("*insert message here* ");
System.out.println("*insert message here* ");
}
}
Students will be able to:
System.out.print
and System.out.println
This lesson introduces students to the foundational concept of variables in Java, including declaring, assigning, and initializing variables. Through a series of videos, hands-on activities, and exercises, students will explore how different data types work in Java and how to use variables effectively in their programs. The lesson aims to build a strong understanding of variables to support future programming concepts.
Students will be able to:
This lesson focuses on handling user input in Java. Students will learn how to capture and utilize user inputs through variables and practice with hands-on exercises involving personal data and creative writing. By exploring examples and completing exercises, students will gain practical experience in using user input commands and applying them in various contexts.
Students will be able to:
This lesson introduces students to writing programs that solve arithmetic expressions in Java. Students will learn about using variables for computation, handling different data types, and understanding potential pitfalls such as round-off errors and integer overflow. The activities are designed to build a strong foundation in arithmetic operations and computational accuracy in Java.
Students will be able to:
In this lesson, students will explore the concept of type casting in Java, a process where one data type is converted into another. Through various hands-on activities, they will learn how to cast variables between different types, understand the implications of casting, and apply these concepts to real-world problems like rounding numbers and managing data types in mathematical expressions.
Students will be able to:
int
to double
and vice versaIn this lesson, students will explore the concept of Boolean logic in Java, focusing on the creation and usage of Boolean variables. Through hands-on activities, they will learn how to work with Boolean expressions, apply them in conditional statements, and understand their significance in controlling program flow. The lesson will emphasize the importance of Boolean logic in decision-making processes, both in programming and in real-world scenarios.
Students will be able to:
In this lesson, students will delve into the use of logical operators in Java to create complex conditional statements. By exploring examples and exercises, students will learn how to combine multiple conditions using logical operators like &&
(AND), ||
(OR), and !
(NOT) to control the flow of their programs. This lesson emphasizes the importance of logical thinking in programming and how it can be applied to solve real-world problems, such as determining grade ranges or evaluating multiple criteria.
Students will be able to:
&&
, ||
, and !
to create compound Boolean expressionsIn this lesson, students will explore comparison operators in Java, which are essential for making decisions within a program. By learning how to compare variables using operators such as ==
, !=
, >
, <
, >=
, and <=
, students will gain the ability to evaluate expressions and control the flow of their programs based on conditions. Through a series of examples and hands-on exercises, students will understand how comparison operators are used in real-world scenarios, such as grading systems, and apply these concepts to their own programming projects.
Students will be able to:
In this lesson, students will learn about the structure and application of for loops in Java, an essential programming construct for automating repetitive tasks. By understanding how to create, control, and manipulate loops, students will develop the ability to perform tasks such as counting, summing, and iterating over sequences of numbers. The lesson includes hands-on activities where students will apply for loops to solve real-world problems, enhancing their logical thinking and coding skills.
Students will be able to:
In this lesson, students will explore the concept of while loops in Java, a fundamental control structure used to repeat a block of code as long as a specified condition is true. Through examples and exercises, students will learn how to create and control while loops, understand the risks of infinite loops, and compare while loops with other loop structures like for loops. By the end of the lesson, students will have a solid understanding of when and how to use while loops effectively in their programs.
Students will be able to:
In this lesson, students will explore the use of if statements in Java to control the flow of their programs based on boolean conditions. They will practice implementing and nesting if statements to solve various problems, including determining even and odd numbers, finding minimum values, and evaluating voting eligibility. Through hands-on activities and exercises, students will gain a deeper understanding of conditional logic and its applications in programming.
Students will be able to:
In this lesson, students will explore the concept of the “loop-and-a-half” in Java programming, which involves using a while loop with a break statement to handle specific conditions. They will practice implementing and comparing loop-and-a-half constructs with traditional while loops through examples and exercises. The goal is to understand the efficiency and application of different looping techniques in programming.
Students will be able to:
In this lesson, students will learn about short circuit evaluation in Java, a technique used in logical operations to optimize code performance and prevent unnecessary execution of expressions. By understanding how short circuiting works with logical AND (&&
) and OR (||
) operators, students will gain the ability to write more efficient and safe code. The lesson includes truth table explorations, examples, and exercises that emphasize the practical applications of short circuit evaluation in programming.
Students will be able to:
In this lesson, students will be introduced to De Morgan’s Laws, fundamental rules in logic and Boolean algebra that describe the relationship between conjunctions and disjunctions in expressions. These laws are essential for simplifying and understanding complex Boolean expressions in programming. Through examples, visual aids like truth tables and Venn diagrams, and hands-on exercises, students will learn to apply De Morgan’s Laws to optimize and clarify code.
Students will be able to:
In this lesson, students will be introduced to Strings, a fundamental data type in Java used to store and manipulate text. They will learn how to create, compare, and modify Strings using built-in methods, including .equals()
. Through practical examples and exercises, students will explore how Strings can be used in programming to handle user input, perform comparisons, and manage text-based data.
Students will be able to:
.equals()
methodIn this lesson, students will complete a comprehensive quiz covering the basic Java concepts learned in previous lessons. This quiz is designed to assess students’ understanding of key programming principles and their ability to apply these concepts in a variety of scenarios. The quiz will help students identify areas where they may need additional practice and reinforce their knowledge in preparation for more advanced topics.
Students will be able to
In this lesson, students will explore methods in Java. Methods help us organize our code into reusable parts, so we don’t have to write the same code over and over again. This makes code easier to understand and manage.
Students will be able to:
In this lesson, students are introduced to parameters. Parameters act as inputs for methods. Imagine methods as boxes, with parameters being the items placed inside these boxes. By using parameters, methods become more versatile, allowing them to handle different versions of the same problem.
Students will be able to:
In this lesson, students will expand their understanding of methods by creating reusable code blocks to perform calculations and return values. They will practice creating methods that calculate and return various values, such as sums, doubled numbers, squares, and averages.
Students will be able to:
This lesson introduces Javadocs, which is a standard way to comment Java code. Students will also complete various coding exercises to practice creating methods with return values. By the end of the lesson, students will be able to write well-structured and documented code using methods and Javadocs.
Students will be able to:
In this lesson, students will learn about String methods. They’ll explore a code example that demonstrates String indexing and looping. Students will then complete coding exercises where they write methods that transform Strings in various ways, including converting text to uppercase, adding specific prefixes, and formatting names. Through these exercises, students will simulate real-world text manipulation scenarios!
Students will be able to:
In this lesson, students will explore concepts related to Strings and characters in Java, such as Strings vs characters, escape sequences, and methods from the Character class.
Students will be able to:
\n
and \"
)Did you know that when a bug occurs in your program, Java helps by throwing an Exception? This exception provides valuable information about where the bug is and what kind of problem is happening. Remember, bugs are a normal part of programming and offer clues to fix issues in our code. In today’s activity, students will explore different types of exceptions and learn how they can assist in debugging. Through various exercises, students will practice identifying these errors and applying solutions, enhancing their ability to effectively debug their programs.
Students will be able to:
So far, students have explored how to write their own methods that accept parameters and return values, and have learned how Strings and characters interact. They’ve also learned to use methods from the String and Character classes and how to loop through a String’s characters using a for loop. In this lesson, students will combine these skills and write methods for more advanced String manipulations.
Students will be able to:
In this lesson, students will apply everything they learned from the Methods Unit to complete a multiple-choice summative assessment. The assessment will cover concepts such as parameters, procedures, methods, Javadoc, debugging, errors, method calls, and method syntax.
Students will be able to:
In this lesson students learn about classes and objects, the foundation of Object Oriented Programming. This lesson introduces a lot of new vocabulary, but it will be reinforced and used in concrete examples and exercises over the next several lessons.
Students have been creating objects of the String class, they just haven’t dove into that terminology yet. In this lesson, students will learn about objects, which are things that have state and behavior, and classes, which are the templates for creating objects. Students will be creating instances of objects in this lesson.
Students will be able to:
In this lesson, students will dive deeper into the relationship between classes, objects, and instances (generally instances and objects refer to the same thing). Students will get more practice identifying classes and objects, creating objects from classes, and calling methods on objects.
Students will be able to:
In this lesson, students learn about the overarching idea of “using a class as a client”. In Java, everything is represented as a class. Classes are a nice way of bundling up functionality. There are classes written for a lot of common needs (such as the String
class and the Character
class), and we can use these classes in our programs.
When someone else creates a class, and you use the functionality of that class, that is called being a client of the class. Users don’t need to know exactly how everything works inside the class, they can just use all the functionality of that class without worrying about the inner workings. For example, you can use the String class to create String objects, and call methods on the objects to get information like the length and the characters at certain indices, without ever looking at the source code for the String class.
Students will be able to:
Now that students have had practice using classes without actually changing the source code for a class, they dive in and actually start writing our own classes. In this lesson, students will learn the basics of writing classes including implementing constructors, using instance variables, and writing a toString
method.
Students will be able to:
In this lesson, students will learn about instance methods and start adding more interesting instance methods to their classes. The instance variables define the state of an object (instance), and the instance methods define the behavior of an object (instance). Instance methods give the object new abilities, they define what the object can actually do.
toString is one example of an instance method, it returns the instance’s (object’s) instance variables put together as a String, that way the instance can be printed out to the screen. It gives an object the ability, or the behavior, to represent itself as a String. In this lesson, we’ll start adding more instance methods to our classes.
Students will be able to:
In this lesson students will learn about a special type of instance method: getter and setter methods. Getter and setter methods give the client access to the private instance variables in a class. Programmers don’t want to make instance variables public because then the client has full access to them, and might accidentally do something that messes them up (for example, it doesn’t make sense to have a negative width or a negative height for a Rectangle object). Instead, programmers expose limited access to them through getter and setter methods. That way, they can allow only certain changes to the instance variables, and block other changes.
Students will be able to:
In this lesson students learn about Class methods and Class variables, which are different from Instance methods and Instance variables.
Students have learned a lot about Instance methods and Instance variables. Each instance of a class has its own instance methods, and its own instance variables. For example, two different Rectangle objects can each have their own width and their own height. These values can be different from instance to instance.
The key difference with Class methods and Class variables is that all instances share the exact same Class methods and Class variables. Each instance does not get its own copy, it is all shared among instances. These methods and variables exist at the Class level, not the Instance level.
Class methods and Class variables are specified using the static
keyword.
Students will be able to:
In this lesson, students will learn how to convert primitive types to object types using a wrapper class. They will learn how Java automatically converts types using autoboxing and unboxing.
Students will be able to:
In this lesson students will learn about method overloading: writing several different methods, each with the same name. As long as each method’s parameter list is different, method can use the same name multiple times!
Students will be able to:
In this lesson students explore the scoping of a variable, which is where the variable is “defined” or where it exists. In this lesson getting students to define and explain the concept themselves is key.
Students will be able to:
In this lesson students learn several new vocabulary terms about Classes and Object Oriented Programming. There’s a lot of vocab in this lesson, but it’s all important for the AP exam. Many of these terms students have seen before, however this lesson will describe what they mean.
The most important term to learn is the this
keyword. this
is a reference to the current instance. this
is used to avoid naming conflicts between instance variables and parameters.
Students will be able to:
this
keyword to solve variable shadowing problemsIn this lesson, students learn about the difference between primitive and object variable types. So far, students have used these different variable types, but have not explored the differences between the two.
This lesson looks at the differences between primitive and object types and discusses the implications of these differences.
Students will be able to:
In this lesson, students learn about class hierarchy and make subclasses and superclasses. Class hierarchy is a critical part of the Java language and used to help reuse code between classes.
Students will explore the relationships of classes in this lesson and then extend that to class design in the next lesson.
Students will be able to:
In this lesson, students learn about class structure and how we can further enhance that class structure with abstract classes. They will then use this knowledge to implement abstract classes.
Abstract classes are a key concept for polymorphism. In this lesson, students will get the knowledge of how to use abstract classes, but some of the reasons why we implement them will become more apparent in the next lesson.
Students will be able to:
In this lesson, students learn about polymorphism and how it applies to dynamic binding at run time. Students will also explore how polymorphism can be used as a formal parameter in methods or as a declaration type for arrays or ArrayLists.
Students will be able:
In this lesson, students will call and use the Object superclass. The Object class is the superclass of all other classes in Java.
Students will be able to:
In this lesson, students will learn about interfaces. Interfaces share a lot of similarities with abstract classes and part of this lesson will focus on comparing the two.
Students will make and implement their own interfaces as well as implementing interfaces that are created by Java.
Students will be able to:
In this lesson, students demonstrate content knowledge of the unit’s learning objectives.
Students will be able to:
In this lesson, students will learn about four types of Data Structures. An array is a list of fixed size. An array list is a list of changing size. A 2D-Array is a grid, table, or list of lists. A Hash Map is a Key-Value store.
Students will be able to:
In this lesson, students learn about arrays and make their first arrays. Arrays are one of the main data structures students will need to understand. This lesson introduces the idea, shows students how to create them, and explains how to access data elements to retrieve and update values.
Students will be able to:
In this lesson, students will learn how to traverse an array to access all of the array elements. They will then apply this to real-world activities.
Students will be able to:
In this lesson, students will explore enhanced for loops. An enhanced for loop is an alternate method to traverse an array instead of using a traditional for loop or while loop.
Students will be able to:
In this lesson, students will learn about ArrayLists and make their own ArrayLists. They will then learn basic methods for ArrayLists to traverse, add, and access the elements in the ArrayList.
While this lesson focuses on ArrayLists, students should be starting to think about how Arrays and ArrayLists are similar and different. This concept is key and will be further explored in the next lesson.
Students will be able to:
In the lesson, students will learn more about the differences between Arrays and ArrayLists and make an ArrayList like class using an Array.
Having learned two different data structures for storing lists, it is only natural to compare and contrast these two structures. Students should come into this lesson with a basic understanding of differences but will develop a deeper understanding through a series of examples and activities.
Students will be able to:
In this lesson, students will explore the uses and properties that for and while loops have in common. Students will practice traversing ArrayLists using several types of loops.
Students will be able to:
In this lesson, students will learn about the list interface and use this to implement generic formal parameters and create classes that use the List interface.
This lesson is not currently in scope for the AP test, but understanding how to implement and use Java interfaces is a key concept for object-oriented programming.
Students will be able to:
In this lesson, students will learn about 2D arrays. The will also first be exposed to the idea of a nested loop, which will be used to access all the elements in a 2D array.
2D arrays are a key idea for students to grasp. They should spend time to fully understand how the loops execute. They can further supplement these concepts through the Traversing 2D Arrays exercises in the Supplemental Material.
Students will be able to:
In this lesson, students will extend their learning on 2D arrays by traversing through them. When attempting to access all elements in a 2D array, we can do so in two different ways. Row-major order traverses the 2D array by accessing each value in a row before moving to the next row and column-major order traverses each column down all rows before moving to the next column.
Students will be able to:
In this lesson, students will learn about HashMaps and use them to create solutions to real-world problems. HashMaps offer a different way of storing data in Java using a key/value pair. While this topic is out of scope for the AP test, it is a key data structure used in several programming languages and may make a good topic for after the AP test.
Students will be able to:
In this lesson, students learn how to convert from different number systems to decimal. They also learn more about why binary is used by computers and have an opportunity to write a code that will convert a binary number into a decimal number.
Students will be able to:
In this lesson, students will discuss the ethical issues around how and why data is collected. They will look at the risks to personal privacy when working on computer systems and the internet and discuss how computer programs can have beneficial and/or harmful impacts on personal security. Lastly, the importance that programmers have in terms of safeguarding personal privacy will be considered and emphasized. This lesson corresponds with AP Computer Science A topic 7.7.
Students will be able to:
This lesson is a summative assessment of the unit’s learning objectives.
Students will be able to:
In this lesson, students learn about creating a large scale project using multiple classes. This lesson walks through the creation of a basic Blackjack game.
Students will be able to:
In this lesson, students will learn about 2D arrays and classes by creating a Battleship program. Through a series of lessons, the game will be broken down into pieces to help implement the solution.
Students will be able to:
In this lesson, students will learn about the basics of algorithms, how they are used in programming, and how algorithms exist in their daily life outside of computer science.
Students will be able to:
In this lesson, students are exposed to the first classic Search algorithm, Linear Search. Students will learn how to code Linear Search, and understand the use and limitation of this algorithm.
Students will be able to:
In this lesson, students learn another algorithm for searching, Binary Search. Students will compare Binary Search to Linear Search, and discuss the reasons why they might need multiple ways to search a list.
Students will be able to:
In this lesson, students learn the basics of sorting. As learned in the previous lesson, Binary Search is a useful search method, but it’s limited by the fact that the lists it searches need to be sorted. In this lesson, students learn that Selection Sort is one way they can sort lists in order to effectively use Binary Search.
Students will be able to:
Student learn a new sorting method, Insertion Sort. As learned in the previous lesson, Binary Search is a useful search method, but it’s limited by the fact that the lists it searches need to be sorted. In this lesson, students learn that Insertion Sort is another way they can sort lists in order to effectively use Binary Search.
Students will be able to:
In this lesson, student learn the concept of recursion. Recursion is the idea that functions can call themselves within the function. This creates an iterative process that allows functions to iterate without using for or while loops, but only conditional statements. Students will practice using recursion, and model it with real world scenarios.
Students will be able to:
Students will learn about a third sorting algorithm, Merge sort. Merge sort uses recursion to break down lists into sublists, and sorts those sublists until the entire list is sorted. Students will compare Merge sort to other sorting methods that they’ve learned.
Students will be able to:
In this lesson, students will examine the concept of informal code analysis. This includes an algorithm’s correctness, efficiency and the ability to be understood.
Students will be able to:
This lesson is a summative assessment of the unit’s learning objectives.
Assess student achievement of the learning goals of the unit.
This lesson is a practice exam that prepares students for the AP Computer Science A exam in May. Like the AP Exam, this lesson consists of a multiple choice test that assesses the learning objectives of the course, as well as free response questions that require students to read a prompt, understand the problem, plan a solution, and write clear and readable code that solves the problem.
Students will be able to…
In this unit, students get to combine all of the new skills they’ve learned to create their own project from scratch!
Congratulations! You have completed the AP Java course! Time to celebrate and reflect on your accomplishments.
Students reflect on what they have learned in the course, celebrate the accomplishment of completing the course, and think about what their next steps are in their computer science education.