The Java 2 Programmer Cram Sheet

DECLARATIONS AND ACCESS CONTROL

  1. An array declaration uses square brackets to indicate the dimension of the array. Note that these brackets can appear with the type, with the variable name, or as a mixture. Array creation uses the new keyword. Newly created numeric primitive arrays are filled with zeros; boolean arrays are filled with false; reference arrays are filled with null. Examples:

    int[] x = new int[32] ; // zeros
    boolean flg[] = new boolean[ 100 ] ; // false
    Float[] y[] = new Float[10][10] ; // null
    
  2. If a package statement is present, it must be the first noncomment statement in the file.

  3. You don't have to import the java.lang package. However, every other package you use must be named in an import statement, ...

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.