topics *NOT* required for T4: - matlab/java graphics/plotting - helpful: Java conditional expression $TEST ? Vtrue : Vfalse$ topics potentially on T4 but not worth all that many points: o vectorization o loop invariants o big-oh notation, performance o inheritance topics required for T4: all topics covered on earlier exams plus material covered since then, with an emphasis on recent material. java + box scope diagrams + $//$ or $/*$-$*/$ for comments + $%$ is remainder operation + $&&$, $||$ are short-circuiting "and" and "or" + statement block: code within braces (${$, $}$) -- has new scope + declaration: $TYPE x;$ to declare (create) a variable $x$ of type $TYPE$. + constants: $final$, tradionally named in all upper-case, e.g. $ACE$. + $for$ loops, $while$ loops, conditionals $if$ and $if$-$else$. + class or static variables and methods + instance (non-static) variables and methods + parameters and other local variables + local variables do *not* get default values, but instance and static variables do get default values + methods + constructors + return type, $return$ statement, $void$ + typecast/cast/convert/coerce $VALUE$ to be of type $TYPE$: $(TYPE) VALUE$ + primitive/scalar types + $int$: default value $0$ + careful: $/$ on integers returns an integer, e.g. $3/2$ is $1$. + $double$: default value $0.0$ + $char$: don't use default value ($(char) 0$) + $boolean$: default value $false$ + objects, references to objects + aliasing + default value: $null$ + strings + type is $String$ + methods: $length()$, $charAt()$, $toCharArray()$, $toUpperCase(), $toLowerCase(), $equals(s)$, $new String(c)$, $new String(s)$ + arrays + box scope: draw in class $Object$ + 2D array = array of arrays + type is $TYPE[]$ or $TYPE[][]$ + new array with default values: $new TYPE[size]$ or $new TYPE[size][]$ + new array with existing values $V1$,...,$Vn$: $new TYPE[] {V1, ..., Vn}$ + length of array $x$: $x.length$ + $i$-th element of array $x$: $x[i]$ + $new TYPE (...)$ to create a new object in class $TYPE$ + user-defined + $private$ versus $public$ + $System.out.print$ and $System.out.println$ + TokenReader: $readInt$, $readDouble$, $readString$ (we'll give you the line $TokenReader in = new TokenReader(System.in);$) + inheritance + terminology: sub-class, super-class, override a method + syntax: $extends$ + call inherited constructor: $super(...);$ + call inherited method $m$: $super.m(...);$ + instance variables and instance methods are inherited + new access modifier: $protected$ + polymorphism: a variable declaration $Foo x;$ where $Foo$ is a class means "$x$ holds $null$ or a reference to an object in class $Foo$ or an object in a subclass of $Foo$". + the actual implementation of a method used depends on the actual class of the object, not the declared type of the reference