O'Reilly logo

Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) by Marcus Green, Bill Brogden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required