
Learn how while loops repeat statements while a boolean expression is true, increment a value to terminate the loop, and avoid infinite loops by ensuring the condition becomes false.
Explore how for loops control a known number of iterations using initialization, test condition, and change, separated by semicolons, and compare them to while loops.
Develops algorithms with strings by reversing a string using a for loop and substring indexing, then removes all lowercase 'a' from 'Alabama' using a while loop and string concatenation.
Explore nested iteration with an outer loop and an inner loop to print five 'O's per row, forming a 3 by 5 grid with line breaks after each five.
Practice informal code analysis by predicting the output of loops. Learn how loops produce outputs, a key skill for the MCU portion of the AP Computer Science A exam.
Explore how public and private modifiers control access to class members, with private name, email, and phone number accessible only inside the class, and a public constructor and print method.
Examine two constructor types: the default no-argument constructor Java supplies when none is defined, initializing fields to defaults, and an explicit constructor that assigns age and birth year from parameters.
Review documentation with comments in Java to enhance readability, using single-line and block comments. Define preconditions and postconditions to specify valid inputs and outputs for a method.
Explore accessor and mutator methods in a Java value class, showing how a private int is accessed with get and modified with set, and how toString prints the object.
Review writing methods in AP Computer Science A - Part 2 with a concise diagram that recaps concepts from earlier units.
Learn how static variables keep a class-wide maximum temperature across multiple objects by updating the static maxTemp when a new instance reports a higher value.
Explore how scope defines where a variable is usable in a Java class, comparing instance and local variables. Learn how a local variable can override instance variable in a method.
Use the this keyword to refer to the current object inside a constructor, distinguishing between the constructor parameter name and the instance variable, for example this.name versus name, reducing errors.
Create arrays of various types, some with predefined values using curly braces and some uninitialized with default values, and access elements by zero-based indices and the length attribute.
Learn to traverse Java arrays, set values by index, and print results; locate a target name in a string array using a loop and equals, returning -1 if not found.
Use enhanced for loops to iterate through an integer array, sum its elements, and compute the average by casting to double, demonstrated with nums containing 1, 3, 5, 7, 9.
Develop algorithms using arrays by iterating the numbers array with a for-each loop, initializing max with the first element, and updating when a larger value is found to track maximum.
Learn to use array lists in Java as a resizable collection with ArrayList<Type>, import java.util, and construct with new ArrayList<>(); use Integer for numbers and name lists like shopping cart.
Explore array list methods on a shopping cart of strings, including add (boolean return), size, remove, get (returns object), set (returns object), and index-based insertion.
Traverse an integer ArrayList with an enhanced loop to sum values, then use a while loop to remove a target element, decrementing the index to avoid skipping elements.
Learn how to detect duplicates in an ArrayList with nested loops that compare each element to every other, using i and j indices to count duplicates.
Explore sequential and binary search in Java, using arrays and ArrayList, for loops, and string comparison to locate a target or return -1, noting that binary search requires sorted data.
Sort arrays into alphabetical or numerical order using selection sort to place the smallest value first and insertion sort to insert into the sorted left side; merge sort is recursive.
In this easy-to-understand, multi-part course, learn all the required topics for the AP Computer Science A exam! You’ll be taught the fundamentals of the Java programming language, covering data types, objects, classes, boolean expressions, if statements, loops, strings, arrays, ArrayLists, 2D Arrays, inheritance, recursion, and more!
This is Part 2, which will specifically cover:
Iteration
Writing Classes
Arrays
ArrayLists
Note: While this course only covers units 4-7 out of a total of 10 AP CSA units, check AlgoSTEM’s Udemy profile to locate the other units!
Information about the Instructor:
Amanvir, has already taken the AP Computer Science A exam with the highest possible score of a 5. By utilizing the information and experience he has acquired from taking the AP Computer Science, Amanvir hopes to teach others about various topics and techniques required to score highly on the exam. Outside of creating this course, Amanvir is an avid programmer and enjoys creating various apps.
AlgoSTEM is a non-profit organization led by Arushi Gupta and Akshaj Gupta that aims to increase accessibility to STEM education. Through its free online courses, AlgoSTEM has taught over 35,000 students worldwide. AlgoSTEM instructors are experienced and knowledgeable about the subjects they teach which include computer science, math, and various sciences.
Along with having multiple Udemy courses, AlgoSTEM has a popular YouTube channel called Algorythm that covers solutions to coding problems including those from Leetcode, Codeforces, Codechef, and various math competitions.