Self-Review Exercises

  1. 10.1Fill in the blanks in each of the following statements:

    1. The public members of a class are also known as the class’s            or           .

    2. If a method contains a local variable with the same name as one of its class’s fields, the local variable            the field in that method’s scope.

    3. The            is called by the garbage collector before it reclaims an object’s memory.

    4. If a class declares constructors, the compiler will not create a(n)           .

    5. An object’s            method can be called implicitly when an object appears in code where a string is needed.

    6. Composition is sometimes referred to as a(n)            relationship.

    7. A(n)            variable represents classwide information that’s shared by all the objects of the class.

    8. The            states that code should be granted only the amount of access needed to accomplish its designated task.

    9. Declaring an instance variable with keyword            specifies that the variable is not modifiable.

    10. The            operator returns the string representation of an identifier’s name.

    11.            enables you to define how built-in operators work with objects of your own types.

    12.            enable you to add new capabilities to existing types.

  2. 10.2 Suppose class Book defines properties Title, Author and Year. Use an object initializer to create an object of class Book and initialize its properties.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset