The second test will be given in class on Wednesday, April 7. You can expect a format similar to the first test, including both essay-type questions, questions that ask you to write code, and questions that ask you to understand code.
The test will cover material that we have done since the first test. This includes threads and multiprocessing (Sections 8.5.1, 8.5.2, and 8.5.3; material on blocking queues), some basic facts about BufferedImages and networking (Sections 12.1.1 and 10.4.1), generic programming and the Java Collection Framework (Sections 10.1 through 10.4, omitting 10.2.4 and 10.3.2), and streams and files (Section 11.1 except for 11.1.4 and 11.1.6, Section 11.2, and Section 11.3).
Here are some terms and ideas that you should be familiar with:
multi-processor computers and why parallel processing is necessary threads the Thread class writing subclasses of Thread the run() method in a thread starting a thread, running a thread in parallel with other threads race conditions; what can happen when two threads both use a shared resource why access to shared resources needs to be controlled with synchronization synchronized methods what it means for a thread to block why threads are often used in network programming ArrayBlockingQueue<T> and LinkedBlockingQueue<T> the put() and take() methods in a BlockingQueue (and why they can block) BufferedImages the method image.getGraphics(), where image is a BufferedImage how to draw to a BufferedImage using a buffered image as an "off-screen-canvas" drawing a buffered image with g.drawImage(image,x,y,null) drawing a buffered image with g.drawImage(image,x,y,width,height,null) generic programming what problem does generic programming try to solve? parameterized types; for example, ArrayList<T> wrapper classes; Integer, Double, Character, etc. using wrapper classes with parameterized types; for example, ArrayList<Integer> methods in class Object: toString(), equals(x), hashCode() iterators "for-each" loops; for example: for ( String str : strList )... using a for-each loop to traverse a collection the Comparable interface and the compareTo(x) method the JCF (Java Collection Framework) collections, lists, and sets run-time performance of various operations on lists and sets ArrayLists versus LinkedLists [differences; when to use] HashSets versus TreeSets [differences; when to use] maps keys and values in maps HashMaps versus TreeMaps [differences; when to use] using the keySet() from a map to traverse the map uses of lists, sets, and maps hash tables and their implementation as arrays of linked lists how a hash code is used in a hash table Generic interfaces and classes in the Java Collection Framework: Collection<T>; methods: add(x), remove(x), size(), clear(), isEmpty() List<T>; methods: get(index), set(index,x), remove(index) ArrayList<T> LinkedList<T> Set<T> HashSet<T> TreeSet<T> Map<K,V>; methods: put(k,v), get(k), containsKey(k), keySet() HashMap<K,V> TreeMap<K,V> streams for input and output files how streams and files are abstractions and why that is important binary streams versus character streams Unicode InputStream and OutputStream Reader and Writer IOExceptions Scanner PrintStream files, directories, and file paths the File class; the exists() method FileInputStream and FileOutputStream using a Scanner to read from a file using a PrintWriter to write to a file saving data in a file choosing a format for a data file why use human readable (character) files? the basic idea of XML and why it might be used