Chapter 6

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Appendix C.  Answers to Review Questions


A1:

Encapsulation is the mechanism of encapsulating data and methods into a class and providing a public mechanism for other classes to use your object; the other classes do not need to know what you are doing internally, only that they will get the result they expect.

A2:

get/set methods are accessor methods to your class's public attributes; set methods allow you to maintain the integrity of your class's attributes by validating the value passed to them before assigning to your internal attributes.

A3:

A class's constructor is a method that initializes the class; it is the first method called when instantiating the class.

A4:

A public variable is accessible from objects outside of the class while private variables are only accessible from within the class.

A5:

The this variable is used to dereference methods and/or variables from within a class; it represents "this" class.

A6:

Composition is the concept of a class containing another class instance.

A7:

Garbage collection is an action that the Java Virtual Machine (JVM) performs to reclaim memory no longer being used in your Java application. It is run whenever the JVM needs to reclaim memory.

A8:

Inner classes are classes defined inside of another class. Inner classes may be regular classes, static inner classes, or anonymous inner classes.

A9:

"Pass By Reference" means that when variables are passed to other objects or methods, the object being passed is not a copy of the original object but rather a reference back to the original object; modifying the object reference modifies the object itself.

A10:

The significance of Java's objects being passed by reference is that modifying the object reference modifies the object itself.


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net