Section 4: Language Fundamentals

  • Identify classes that correctly implement an interface where that interface is either java.lang.Runnable or a fully specified interface in the question.

  • State the effect of using a variable or array element of any kind when no explicit assignment has been made to it.

Relevant Sections

Read Sections 2.3 "Variable Declarations" and 2.4 "Initial Values for Variables." For interface implementation, see Section 6.4 "Interfaces." For implementation of java.lang.Runnable, see Section 9.3 "Thread Creation."

Study Notes

Interfaces can be defined within several contexts, and the contexts influence the meaning of the declaration and the modifiers applicable. The modifiers used also influence the restrictions that apply for the implementation of methods. Certain rules of consistency must be observed when extending or implementing interfaces. Methods are distinguished from each other at compile time, based on the method signature.

Each primitive data type has a range of valid values and a default value. Depending on the context of the declaration, some variables are either initialized to a default value or remain uninitialized until first assigned a value. Code that tries to access uninitialized variables is illegal. Elements of array objects are always initialized.