Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

Workshop 153

Workshop


The following questions see if you have the attributes and behavior to under-
stand OOP techniques.


Quiz



  1. In a Java class,a method is an example of what?
    A. Attributes
    B. Statements
    C. Behavior

  2. If you want to make a variable a class variable,what statement must
    you use when it is created?
    A. new
    B. public
    C. static

  3. What is the name for the part of a program in which a variable lives?
    A. Its nest
    B. The scope
    C. Variable valley


Answers



  1. C.A method is made up of statements,but it’s an example of behavior.

  2. C.If the staticstatement is left off,the variable is an object variable
    instead of a class variable.

  3. B.The compiler fails with an error when a variable is used outside of
    its scope.

Free download pdf