Title: JavaChapter8

Q: Is it possible to have multiple classes in one file?
A: Yes.

Q: What does the 'this' keyword do?
A: Allow an object to reference itself.

Q: What is an overloaded constructor?
A: Something that enables ojbects to be initilaized in different ways.

Q: What type of constructor is invoked withwouth an argument?
A: no-argument constructor

Q: What is another term for a set method?
A: Mutator method

Q: What is a set method also known as a mutator method?
A: It changes an object's state

Q: What is another name for an accessor or query method?
A: Get method

Q: What is a method that tests if a condition is true or false called?
A: Predicate method

Q: What does composition mean in terms of computer science?
A: A class that references objects of other classes as memebers

Q: How do you delcare an enumeration?
A: public enum "name of class"

Q: What does it mean if something is immutable?
A: It cannot be modified after creation.

Q: What do packages do?
A: Provide a convention for unique class names to prevent conflicts

Q: An attempt by a method that's not a member of a class to access a private member of that class is [...]
A: a compilation error.

Q: "this reference"
A: how an object can access a reference to itself

Q: if the method contains a parameter or local variable that has the same name as a field of the class, a [...] must be used to access the field of the class - otherwise, the [...] will be referenced.
A: "this reference"; method parameter or local variable

Q: no-argument constructor
A: constructor invoked without arguments. Causes a default constructor to not be created by the compiler.

Q: reasons to use set and get methods
A: can access a class's private data. Simplifies code maintenance and reduces the likelihood of errors.

Q: Enumerations
A: defines a set of constants represented as unique identifiers

Q: 3 enum declaration restrictions
A: 1. enum constants are implicitly final, because they declare constants that shouldn't be modified.
2. enum constants are implicitly static.
3. Any attempt to creat an object of an enum type with operator new results in a compilation error.

Q: Garbage collection
A: Performed automatically in the background to reclaim the memory occupied by objects that are no longer used.

Q: Static field
A: a class variable. Represents classwide information

Q: immutable
A: cannot be modified after they're created.

Q: Static import declaration
A: enables you to import the static members of a class or interface so you can access them via their unqualified names in your class (class name and dot are not required).

Q: principle of least privilege
A: code should be granted only the amount of privilege and access that it needs to accomplish its designated task, but no more.

Q: no-argument constructor
A: once declared, no default constructor will be provided

It's a compilation error when this is used in a constructor's body to call another constructor of the same class if that call is not the first statement in the constructor.

Q: predicate methods
A: common use for accessor methods that tests whether a condition is true or false

Q: composition
A: references to objects of other classes as members

Q: enum declaration
A: comma-separated list of enum constants

Q: static variable
A: represents classwide information

Use a static variable when all objects of a class must use the same copy of the variable.

Q: Referring to this in a [...] method is a [...] error.
A: static; compilation

Q: [...] allow objects to be initialized in different ways
A: Overloaded Constructors

Q: [...] initialize each instance variable without arguments
A: No-argument constructors

Q: [...] are accessor methods that test whether a condition is true or false
A: Predicate methods

Q: [...] is when a class references objects of other classes as members
A: Composition

Q: Enum types are declared with an [...]
A: enum declaration

Q: JVM automatically performs [...] to reclaim the memory occupied by an object no longer in use
A: garbage collection

Q: When no references to an object are made JVM executes its [...]
A: garbage collector

Q: [...] is called by the garbage collector to perform termination housekeeping
A: finalize method

Q: [...] represents classwide information of all objects of class share the same piece of information
A: Static variable

Q: [...] in java means that a string object cannot be modified after they are created
A: Immutable

Q: this
A: Keyword that causes an object to access a reference to itself.

When a non-static method is called for a particular object, the method's body implicitly uses keyword this to refer to the object's instance variables and other methods.

Q: [...] are also commonly called [...].
A: Set methods; mutator methods

Q: [...] are also commonly called [...] or [...].
A: Get methods; accessor methods; query methods

Q: [...] are also known as [...].
A: Compositions; has-a relationships

For every enum the compiler generates the static method values that returns an array of the enum's constants in the order they were declared.

Q: range
A: Static method that displaus a range of an enum's constants

Q: Method finalize has return type [...].
A: void

Q: A static field called a class variable
A: Used when only one copu of a particular cariable should be shared by all objects of the class.

Q: A [...] enables you to import the [...] of a class or interface so you can access them via their [...] in your class.
A: static import declaration; static members; unqualified names

Q: Default constructor
A: A constructer that when given no instructions  is simply supplied by the compiler.

Q: Overloaded Constructors
A: Constructors that enable objects of a certain class to be initialized in different ways

Q: No-argument constructors
A: constructers where the compiler will not provide a default constructor.

Q: Set and get capabilities.
A: Can do the same thing as making the instance variables public.

Q: Predict Methods
A: a use for accessor methods to test whether a condition is true or false

Q: This keyword indicates that a method is not accessible in other classes
A: Private

Q: similar to System.out.printf
A: static method format

Q: these are the access modifiers for variables and methods
A: public and private

Q: A [...] method of an object implicitly uses keyword [...] to refer to the object’s[...] and other methods.
A: non-static; this; instance variables

Q: To call one constructor of a class from another of the same class, you can use the [...] keyword followed by parentheses containing [...].
A: this; the constructor arguments

Q: True or False: all class's have constructors? Why?
A: True, even if you don't declare a constructor, the class provides as default constructor.

Q: another name for set methods
A: mutator methods

Q: another name for get methods
A: accessor methods

Q: define composition
A: when a class has a reference to objects in a different class

Q: [...] constants are implicity [...] and [...]
A: enum; final; static

Q: When there are [...] references to an object, the object is eligible for [...]
A: no more; garbage collection.

Q: these are the parameters that finalize takes
A: none, finalize doesn't take parameters

Q: A [...] variable represents [...] information that’s shared among the class’s [...].
A: static; classwide; objects

Q: this is the keyword that specifies that a variable is not modifiable
A: final

Q: "this"
A: refers to an object's instance variables and methods

Q: public
A: an access modifier that allows one to manipulate and witness what the class does

Q: private
A: an access modifier that hides what the class is doing within its variables and methods

Q: enum constants are implicitly [...]
A: static

Q: enum constants are implicitly [...] because they declare constants that [...] be modified
A: final; shouldn't

Q: Attempting to create an object of "enum" type with "new" results in [...] error
A: compilation

Q: method range
A: takes in first and last enum constants and returns all constants between these numbers

Q: garbage collection
A: An automatic "cleaning" done by the JVM behind the scenes

Q: The [...] is called by the [...] to perfom [...] housekeeping on an object before the garbage collector reclaims the object's memory
A: finalize method; garbage collector; termination

Q: static variable
A: pertaining to the class

Q: String object in Java are [...], because they cannot be modified after they are created.
A: immutable