1 Java: AP Curriculum Focus and Java Subset Alyce Brady.

Slides:



Advertisements
Similar presentations
Written by: Dr. JJ Shepherd
Advertisements

Working With Collections in the AP ™ Java Subset 2003 ACTE Convention © 2003 by Kenneth A. Lambert.
CSC 205 – Java Programming II Lecture 25 March 8, 2002.
1 CS 171: Introduction to Computer Science II Review: OO, Inheritance, and Libraries Ymir Vigfusson.
Algorithm Programming Containers in Java Bar-Ilan University תשס " ו by Moshe Fresko.
What Is a Collection?  A collection (sometimes called a container) is simply an object that groups multiple elements into a single unit.  Collections.
24-Jun-15 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 17 Advanced Java Concepts Data Structure Support.
Lists in Java Part of the Collections Framework. Kinds of Collections Collection --a group of objects, called elements –Set-- An unordered collection.
CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li.
Cmp Sci 187: Midterm Review Based on Lecture Notes.
1 Lecture 26 Abstract Data Types – IV Overview  The List ADT  Implementing Stacks as Linked List  Linked List Implementation of Queues .  Preview:
Java Data Types  Everything is an Object  Except Primitive Data Types  For efficiency  Platform independent  Portable  “slow”  Objects are often.
The Collections Framework A Brief Introduction. Collections A collection is a structured group of objects –An array is a kind of collection –A Vector.
CS 106 Introduction to Computer Science I 04 / 30 / 2010 Instructor: Michael Eckmann.
SEG4110 – Advanced Software Design and Reengineering TOPIC G Java Collections Framework.
OOP Languages: Java vs C++
Arrays And ArrayLists - S. Kelly-Bootle
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Classes, Objects, Arrays, Collections and Autoboxing Dr. Andrew Wallace PhD BEng(hons) EurIng
DataStructures1 Barb Ericson Georgia Tech July 2008.
Collections in Java. Kinds of Collections Collection --a group of objects, called elements –Set-- An unordered collection with no duplicates SortedSet.
Generalized Containers CSIS 3701: Advanced Object Oriented Programming.
Java ProgrammingtMyn1 Java Programming Timo Mynttinen Mikkeli University of Applied Sciences.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
CS 112 Department of Computer Science George Mason University CS 112 Department of Computer Science George Mason University Final Review Lecture 14.
Data Design and Implementation. Definitions of Java TYPES Atomic or primitive type A data type whose elements are single, non-decomposable data items.
Lists and the Collection Interface Review inheritance & collections.
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
1 TCSS 143, Autumn 2004 Lecture Notes Java Collection Framework: Maps and Sets.
Computer Science 209 Software Development Java Collections.
LinkedList Many slides from Horstmann modified by Dr V.
1 Chapter 17 Object-Oriented Data Structures. 2 Objectives F To describe what a data structure is (§17.1). F To explain the limitations of arrays (§17.1).
1/20/03A2-1 CS494 Interfaces and Collection in Java.
3-February-2003cse Collections © 2003 University of Washington1 Java Collections CSE 403, Winter 2003 Software Engineering
1 JAVA API & Packages Starring: Java Documentation Co-Starring: BlueJ IDE.
Georgia Institute of Technology Workshop for CS-AP Teachers Data Structures Barb Ericson June 2006.
Java 2 Collections Bartosz Walter Software Engineering II.
CSE 143 Lecture 24 Advanced collection classes (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, , slides.
1 Collections Framework A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain:
Copyright © 2014 by John Wiley & Sons. All rights reserved.1 Chapter 16 – Basic Data Structures.
This recitation 1 An interesting point about A3: Using previous methods to avoid work in programming and debugging. How much time did you spend writing.
CMSC 341 Java Packages, Classes, Variables, Expressions, Flow Control, and Exceptions.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 9 Inheritance and.
Collections Mrs. C. Furman April 21, Collection Classes ArrayList and LinkedList implements List HashSet implements Set TreeSet implements SortedSet.
CS Ananda Gunawardena.  A collection (sometimes called a container) is simply an object that groups multiple elements into a single unit.  Collections.
Recitation 5 Enums and The Java Collections classes/interfaces 1.
Chapter 15 An Introduction to Data Structures. Chapter Goals To learn how to use the linked lists provided in the standard library To be able to use iterators.
List Interface and Linked List Mrs. Furman March 25, 2010.
Introduction to Collections. Collections Collections provide a way of organizing related data in a model Different types of collections have different.
Written by: Dr. JJ Shepherd
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Data Structures I Collection, List, ArrayList, LinkedList, Iterator, ListNode.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Object Oriented Programming in Java Habib Rostami Lecture 7.
3-1 Java's Collection Framework Another use of polymorphism and interfaces Rick Mercer.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
The AP Java Subset Topics. A Topics Primitive Types int double boolean.
Java Collections CHAPTER 3-February-2003
C++ -> Java - A High School Teacher's Perspective
TCSS 143, Autumn 2004 Lecture Notes
Java Programming Language
The Building Blocks Classes: Java class library, over 1,800 classes:
Abstract Class As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of ,
ArrayLists 22-Feb-19.
Collections Framework
8 List ADTs List concepts. List applications.
Presentation transcript:

1 Java: AP Curriculum Focus and Java Subset Alyce Brady

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 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 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 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 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 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 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 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 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 Java Subset (continued)  Defining Classes  public/private static final constants  private instance variables (data members)  public and private constructors and methods (member functions)

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 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 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 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 Java Subset (continued)  Inheritance and Interfaces  Implementing interfaces  Extending classes inheriting data and methods overriding methods dynamic binding (polymorphism)  Abstract classes

17 Java Subset (continued)  Exceptions (unchecked exceptions)  Understand when they occur  NullPointerException, ArrayIndexOutOfBoundsException, ArithmeticException, ClassCaseException, IllegalStateException, NoSuchElementException

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 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 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 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 Standard Java Lists (java.util) Iterator (interface) boolean hasNext() Object next() void remove() ListIterator (interface) void add(Object x) void set(Object x)

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 Java Subset (AB Additions)  Standard Java Library Classes  java.util.Map (interface)  java.util.HashMap  Java.util.TreeMap  java.lang.Object int hashCode()

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 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