CSC 221: Computer Programming I
Fall 2005

Test 2 Review

TEST 1 MATERIAL overview & history: hardware vs. software, technology generations, ... Java classes: private vs. public, fields, methods, constructor, local variables Java statements: assignment, output, return, (internal & external) method calls expressions: concatenation, arithmetic, precedence, mixed expressions, casting conditionals: if statement, if-else, boolean expression, logical connectives variables: fields vs. parameters vs. local variables, scope OOP and Design design principles, cohesion, coupling simple graphics: Canvas, Circle, Square, ... static fields primitive vs. object types, .equals vs. == String methods: length, charAt, indexOf, substring, equals, compareTo, ... Conditional repetition while loops controlled by boolean expression, condition-driven danger: infinite (black-hole) loops for loops used for counter-driven applications equivalent to while loops simulations: dice, dot race, volleyball, ... Text processing String traversal using for loops & charAt, String construction static methods, StringUtils class, Character class file input File class, exception handling (throws) Scanner class: hasNext, next, hasNextLine, nextLine, hasNextInt, nextInt, ... ArrayLists collection of objects, accessible via indexing (defined in java.util.ArrayList) advantages: can group related values under one name can traverse and systematically access all values via a loop methods: add, get, size, remove, contains, set, indexOf, toString, ... reading and storing values in an ArrayList parallel lists autoboxing/unboxing, wrapper classes (e.g., Integer, Double)

Review Questions