CSC 222: Object-Oriented Programming
Final Exam Review
- To know and use basic Java programming constructs for object-oriented problem solving (e.g., classes, polymorphism, inheritance, interfaces)
- To appreciate the role of algorithms and data structures in problem solving and software design (e.g., objected-oriented design, lists, files, searching and sorting)
- To be able to design and implement a Java program to model a real-world system, and subsequently analyze its behavior.
- To develop programming skills that can serve as a foundation for further study in computer science.
abstraction, object-focused, modularization
classes/methods should be highly cohesive & loosely coupled
Model-View-Controller (MVC) pattern
class vs. object, fields & constructors & methods
private vs. public, static, final
interfaces & polymorphism
List interface, Comparable interface, Collections.sort
defining an interface, implementing an interface
class hierarchies: e.g., Grade --> LetterGrade, passFailGrade
inheritance & polymorphism
derived class, parent class
inheriting methods/fields, overriding methods
IS-A relationship, polymorphism
class hierarchies: e.g., BankAccount --> SavingsAccount, CheckingAccount
instanceof, type casting
primitive types: int, double, char, boolean
object types: String, Integer, Double, ...
math: +, -, *, /, %, +=, -=, *=, /=, %=, ++, --
boolean: ==, !=, >, <, >=, <=, &&, ||, !
assignment, print, return, if, if-else, while, for, for-each
method calls: internal (this.METHOD()) vs. external (OBJ.METHOD())
exception handling: throws, try/catch
String, Character, Collections, Random, ...
formatted output: System.out.format, format strings
Scanner: hasNext, next, hasNextLine, nextLine, hasNextInt, nextInt, ...
FileWriter: write, close
GUI-building in netBeans
arrays and ArrayLists
advantages of ArrayLists over arrays
methods: add, remove, set, get, size, ...
Dictionary example: add, contains, size, display
implementation built on top of ArrayList, generic
unsorted vs. sorted vs. "lazy" sorted versions
big-Oh notation, rate-of-growth
worst case vs. average case vs. best case performance
searching & sorting
sequential search O(N) vs. binary search O(N log N)
Collections.binarySearch, List & Comparable interfaces
insertion sort O(N^2) vs. selection sort O(N^2) vs. merge sort O(N log N)
base case(s), recursive case(s)
avoiding infinite recursion, Cat in the Hat analogy
recursion vs. iteration: efficiency tradeoffs, redundancy
simulations and modeling