Quiz
The following questions will see whether you have the attributes and behavior to understand object-oriented coding techniques.
Questions
1: |
In a Java class, a method is an example of what?
- Attributes
- Statements
- Behavior
|
2: |
If you want to make a variable a class variable, what statement must you use when it is created?
|
3: |
What is the name for the part of a program in which a variable lives?
- Its nest
- The scope
- Variable valley
|
Answers
A1: |
c. A method is made up of statements, but it's an example of behavior.
|
A2: |
c. If the static statement is left off, the variable will be an object variable instead of a class variable.
|
A3: |
b. The compiler fails with an error when a variable is used outside of its scope.
|
|