Download presentation
Presentation is loading. Please wait.
Published byGeorge Lambert Modified over 9 years ago
1
1 Java: AP Curriculum Focus and Java Subset Alyce Brady
2
2 Curriculum Topics Object-oriented programming and design Declaring and constructing objects Invoking methods Interacting objects Class implementations, including method implementations Parameter passing Basic control flow constructs
3
3 Curriculum Topics (continued) Data Structures Primitive types Classes Arrays and ArrayLists Maps and Sets (AB) Stacks and Queues (AB) Linked Lists (AB) Trees (AB) Heaps, Priority Queues (AB)
4
4 Curriculum Topics (continued) Algorithms Traversing Linear Data Structures Accumulate Find Min/Max Searching (e.g., linear, binary) Sorting Traversing Linked Lists and Trees (AB) Analyzing space and time performance (formal analysis -- AB)
5
5 AP Java Subset Why have a subset? Language is big; can’t cover everything. Libraries are bigger; can’t cover everything. Exam can’t test everything. Exam should test fundamental ideas, not every esoteric (or interesting, or even useful) language construct. Subset defines/limits what may be on the exam, not what you can cover.
6
6 Java Subset Primitive Types (similar to C++) int, double, boolean arithmetic operators: + - * / % ++ -- relational & logical: == != < <= && || ! assignment: = += etc. numeric casting: (int) (double), truncation char is not required by subset
7
7 Java Subset (continued) String class (similar to apstring) Declaring and constructing strings String constants String concatenation (+) converting numerics to strings converting objects to strings ( toString ) Escape sequences: \\ \” \n
8
8 Java Subset (continued) I/O System.out.print, System.out.println No other I/O will be tested, so you can use whatever techniques you and your textbook choose, e.g., keyboard input, text fields in graphical user interfaces, mouse events, applets, etc. Case study also uses Debug.print, Debug.println
9
9 Java Subset (continued) Control Structures (similar to C++) if, if - else, if - else if - else for, while return Comments (similar to C++) // /* … */ Case study uses doc. comments /** … */
10
10 Java Subset (continued) Using Objects Constructing objects using new, passing parameters to constructors as necessary Variables are references to objects Dot notation for invoking methods Use of this to pass self to other objects Difference between == and equals null reference
11
11 Java Subset (continued) Defining Classes public/private static final constants private instance variables (data members) public and private constructors and methods (member functions)
12
12 Java Subset (continued) Methods Method calls and method definitions Constructors, accessors, modifiers Parameter passing (always pass-by-value, but passing references by value feels like pass-by- reference) Method overloading; signature depends on number, type, order of parameters super.method to call overridden method definition
13
13 Java Subset (continued) Constructors (similar to C++) Name is same as class; no return value Initialize instance variables in constructors (no initialization lists) Call super to initialize inherited data static constants are initialized when declared: public static final CONSTANT = init_expr;
14
14 Java Subset (continued) Standard Java Library Classes (A list) java.lang.Object java.lang.Comparable (AB only?) java.lang.Integer, java.lang.Double java.lang.String java.util.ArrayList java.lang.Math java.util.Random import statement
15
15 Java Subset (continued) Linear Indexed Data Structures 1D (A) and 2D (AB) arrays, similar to apvector bounds checking myArray[i].length 2D arrays are AB material ArrayList class Core subset of methods Casting from Object to specific class (and casting more generally in other contexts)
16
16 Java Subset (continued) Inheritance and Interfaces Implementing interfaces Extending classes inheriting data and methods overriding methods dynamic binding (polymorphism) Abstract classes
17
17 Java Subset (continued) Exceptions (unchecked exceptions) Understand when they occur NullPointerException, ArrayIndexOutOfBoundsException, ArithmeticException, ClassCaseException, IllegalStateException, NoSuchElementException
18
18 Java Subset (continued) What is NOT in the subset (not testable)? char most I/O main method (used in case study) and applets do/while, switch, break protected visibility (used in case study) many other features
19
19 Java Subset (AB Additions) Standard Java Library Classes java.lang.Comparable (officially AB only) java.util.List (interface) java.util.ArrayList implements java.util.List java.util.LinkedList implements java.util.List java.util.Set (interface) java.util.HashSet implements java.util.Set java.util.TreeSet implements java.util.Set java.util.Iterator java.util.ListIterator extends java.util.Iterator
20
20 Standard Java Lists (java.util) List (interface) boolean add(Object x) int size() Iterator iterator() ListIterator listIterator() ArrayList Object get(int index) Object set(int index, Object x) void add(int index, Object x) Object remove(int index) LinkedList void addFirst(Object x) void addLast(Object x) Object getFirst() Object getLast() Object removeFirst() Object removeLast()
21
21 Standard Java Sets (java.util) Set (interface) boolean add(Object x) boolean contains(Object x) boolean remove(Object x) int size() Iterator iterator() HashSetTreeSet
22
22 Standard Java Lists (java.util) Iterator (interface) boolean hasNext() Object next() void remove() ListIterator (interface) void add(Object x) void set(Object x)
23
23 Collections (NOT in Subset!) Collection (interface) boolean add(Object x) boolean contains(Object x) boolean remove(Object x) int size() Iterator iterator() List ListIterator listIterator() Set
24
24 Java Subset (AB Additions) Standard Java Library Classes java.util.Map (interface) java.util.HashMap Java.util.TreeMap java.lang.Object int hashCode()
25
25 Standard Java Maps (java.util) Map (interface) Object put(Object key, Object value)) Object get(Object key) boolean containsKey(Object key) int size() Set keySet() HashMapTreeMap
26
26 Java Subset (AB Additions) AP CS ListNode and TreeNode Classes Interfaces for Stack, Queue, PriorityQueue There is a java.util.Stack class, but this is not the same as the AP interface and is not in the subset
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.