Chapter 4. Declarations and Access Control

Exam Objectives

  • Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms, both for declaration and for initialization.

  • Declare classes, inner classes, methods, instance variables, static variables and automatic (method local) variables, making appropriate use of all permitted modifiers (such as public, final, static, abstract). State the significance of each of these modifiers both singly and in combination, and state the effect of package relationships on declared items qualified by these modifiers.

    • For nested classes, see Chapter 7.

  • For a given class, determine if a default constructor will be created, and if so, state the prototype of that constructor.

  • Identify the legal return types for any method, given the declarations of all related methods in this or parent classes.

    • For method overriding, see Section 6.2.

Supplementary Objectives

  • Define and use anonymous arrays.

  • Understand usage of this reference in instance methods.

  • Understand the term method signature and state the circumstances under which methods can be overloaded.

  • Identify a non-default constructor, and understand how constructors can be overloaded.

  • State how the package and import statements are used to define packages and import from packages.