Chapter 6


Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Appendix C.  Answers to Review Questions


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.


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.


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


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


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


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


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.


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


"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.


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


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

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: