Section 1: Declarations and Access Control ( Chapter 4 )

  • 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, nested classes, methods, instance variables, static variables and automatic (method local) variables making appropriate use of all permitted modifiers (such as public, final, static, abstract, etc.). 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 a given class, determine if a default constructor will be created and if so state the prototype of that constructor.

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

Study Notes

Arrays are objects. They contain a fixed number of elements of a specific type. The index of the first element is 0. The index of the last element is one less than the length of the array. Note how arrays are declared and constructed. Array size is not specified in the declaration, but is given when the array object is created. Multidimensional arrays are implemented as arrays of arrays.

Modifiers affect classes, methods, and variables and each modifier has a specific significance. Accessibility modifiers specify where classes and methods can be accessed and used. Knowing which modifiers are applicable in a given context is important.

Constructors are not normal methods. They must have the same name as the class. Constructors do not declare a return type, not even void. The implicit default constructor is employed when no constructors are specified. Calls to other constructors from within a constructor must be done as the first statement in the constructor body, using this() or super().



     
    ASPTreeView.com
     
    Evaluation has »ОїФ¶іexpired.
    Info...