J2EEOnline J2EE






Java Certification  «Prev  Next»
Lesson 1

Introduction to Declaring Java Methods

All Java programs involve declarations. Java programs are comprised of declarations of classes, interfaces, constructors, variables, methods, and initializers.
Module 3 covered the declaration of classes, constructors, and interfaces. This module covers variable, method, and initializer declarations.
In this module, you'll review the basics of field and local variable declarations, array declarations, method declarations, and the declaration of initializers.
You will also cover access modifiers and special modifiers. Even though the material you'll cover is very basic, pay attention to the details. The certification exam contains a number of questions that test the depth of your understanding of declarations and modifiers, especially access control modifiers.

Module objectives
This module will review your knowledge of Java variable and method declarations, provide examples of their use, and help you to satisfy the following exam objectives:
  1. Declare instance variables, static variables, and automatic (method local) variables, making appropriate use of all permitted modifiers (such as public, final, static, abstract, and so forth). 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.
  2. Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms, both for declaration and for initialization.
  3. Identify correctly constructed method declarations and variable declarations.
  4. Determine the effect upon objects and primitive values of passing variables into methods and performing assignments or other modifying operations in that method.
  5. State the legal return types for any method given the declarations of all related methods in this or parent classes.
  6. Write code to invoke overridden or overloaded methods and parental or overloaded constructors, and describe the effect of invoking these methods.