Quiz
The following questions will see whether you have the attributes and behavior to understand object-oriented programming techniques.
Questions
1: | In a Java class, a method is an example of what?
|
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?
|
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. |
Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.