1. Chapter 1: Declaration, Access Control
    1. Identifier/JavaBeans
      1. Legal Identifiers: start with letter, $, _
      2. Keywords
      3. Sun's Java Code Conventions
        1. Class Name
        2. Method
        3. Variable
        4. Constant
      4. JavaBeans Standards
        1. get/set method, public
        2. boolean: is/get
        3. event/listener, addActionListener()
    2. Class Declaration
      1. Source File
        1. one public class per source file
        2. comments are anywhere
        3. public class name matches the file name
        4. package should before import
      2. Modifier
        1. Access: public, protected, private, default(package level)
        2. Non-Access: strictfp, final, abstract
          1. strictfp: conform to IEEE 754 floating point
          2. final: cannot be subclassed, java.lang.String
          3. abstract: can never be instantiated, is to be extended
    3. Interface Declaration
      1. Methods are implictly public and abstract, and cannot be static, final, strictfp or native
      2. Variables defined must be public, static and final
      3. Extends from 1 or more interfaces, not implements
      4. Cannot extend anything but interface
    4. Class Member
      1. Access modifier
        1. public: all other classes, regardless of the package they belong to, can access
        2. private: only the class which private member is declared
        3. protected/default
          1. subclass can see protected member only through inheritance
      2. Local variables
      3. Nonaccess member modifier
        1. final method
        2. final arguments
        3. abstract method
        4. synchronized method
        5. native method
        6. strictfp method
        7. variable argument list method
        8. Constractor
        9. variable
          1. primitive
          2. range
          3. reference
          4. local variable: always on the stack, rather than a heap
        10. enum
          1. cannot declare enum in a method
          2. neither String nor int
          3. special kind of class
    5. Wrong subject: 6, 8 and 9
  2. Chapter 2: Object Orientation
    1. Topic
    2. Is-A
      1. Cannot extend more than one class
    3. Has-A
    4. Overriding
      1. Argument list should exactly match
      2. Return type should the same as or a subtype of
      3. Access level can't be more restrictive
      4. Can throw runtime exception
      5. Cannot throw checked exception
      6. Can throw narrower/fewer exceptions
      7. Cannot override final/static method
    5. Overloading
      1. must change the argument list
      2. can change the return type
      3. can change the access modifier
      4. can declare new/broader checked exception
    6. Reference Casting
      1. downcasting
      2. upcasting
    7. Implement interface
      1. A class can implement more than one interface
      2. interface self extend another interface
    8. Return Type
      1. Covariant returns in overriding return type which can be a sub class
      2. Return value
    9. Constructor and Instantiation
      1. every class MUST have a constructor
      2. Constructor Chaining
        1. Horse h = new Horse()
          1. Animal()
          2. Object()
      3. Rules
        1. any access modifier
        2. match the class name
        3. no return type
        4. same name method doesn't make it constructor
        5. default constructor will be automatically generated if no constructor was typed
        6. default constructor ALWAYS a no-arg constructor
        7. once one constructor is typed, no default will be generated
        8. every constructor first either call this() or super()
        9. cannot call directly the constructor
        10. abstract has while interface hasn't
      4. default constructor
        1. same access modifier as the class
    10. Static variables & Method
      1. static method cannot access a non-static variable
      2. static method cannot access a non-static method
      3. static method cannot be overridden
    11. Wrong subjects: 3, 5, 11
  3. Chapter 7: Generic & Collections
    1. Class methods
      1. toString()
      2. equals()
        1. reflexive
        2. symmetric
        3. transitive
        4. consitent
      3. hashCode()
        1. a.equals(b) -> a.hashCode()==b.hashCode()
        2. a.hashCode()!=b.hashCode() -> a.equals(b) == false
        3. transient variable may cause fail
    2. Collections
      1. <<interface>> java.util.Collection
        1. <<interface>>List
          1. ArrayList
          2. Vector
          3. LinkedList
          4. get(int index), indexOf(int index), add(int index, Object obj), etc.
          5. Iterator: hasNext(), next()
        2. <<interface>> Set
          1. SortedSet
          2. HashSet
          3. LinkedHashSet
          4. TreeSet
        3. <<interface>> Queue
          1. PriorityQueue
          2. offer(), poll(), peak()
      2. <<interface>>Map
        1. SortedMap
        2. HashMap
        3. Hashtable
        4. TreeMap
        5. LinkedHashMap
      3. Ordered & Sorted
        1. alphabetically
        2. ascending
        3. implements Comparable
        4. Comparator
      4. utility
        1. java.util.Collections
          1. sort()
          2. Comparable: compareTo()
          3. Comparator:compare()
          4. binarySearch()
          5. void reverse()
          6. reverseOrder()
          7. return a Comparator that sorts in reverse
        2. java.util.Arrays
          1. binarySearch()
          2. sort()
          3. asList(T[])
    3. Generic
      1. MUST be the exactly type in generic when initialize a generic collection
      2. Methods
        1. method(List<? extends Base> parameter)
        2. method(List<? super Child> parameter)
        3. method(List<?> list)
        4. ? means many possibilities
        5. only for reference declarations
      3. Class
        1. class SomeGeneric<T>
        2. class SomeGeneric<T extends Base>
      4. Generic Methods
        1. public <T> void method(T t)
        2. public <T extends Number> void method(T t)
    4. Wrong Exercise: 1, 4, 5, 9, 10, 12, 14 and 16
  4. Chapter 9: Threads
    1. define
      1. Extends java.lang.Thread
        1. constructor
          1. Thread()
          2. Thread(Runnable target)
          3. Thread(Runnable target, String name)
          4. Thread(String name)
      2. Implements Runnable
    2. Starting Thread
      1. t.start()
      2. A thread done when its target run() completes
      3. Once it has been started, it can never be started again
    3. Scheduler
    4. States
      1. New
        1. before start() invoked, not alive
      2. Runnable
      3. Running
      4. Waiting / blocked / sleeping
      5. Dead
    5. Priorities
      1. 1~10
      2. NEVER rely on it to guarantee the correctness
      3. yield()
        1. allow other threads of the same priority to get their turn
    6. Synchronization
      1. methods and blocks
      2. sleep doesn't release the lock
      3. each object has just one lock
      4. static method can be synchronized
    7. When cannot get lock
      1. static synchronized always block each other
      2. method and lock status
    8. methods that access changeable fields need to be synchronized
    9. Thread-Safe Class
      1. Collections.synchronizedList()
    10. Deadlock