Chapters 3&6

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

In UML diagrams, what symbol indicates that a member is public?

+

A UML diagram uses the ________ symbol to indicate that a member is private.

-

If you do not provide initialization values for a class's numeric fields, they will be automatically initialized with what number?

0

CRC stands for

Class, Responsibilities, and Collaborations

________ is the term for the relationship created by object aggregation.

Has a

Assume the following declaration exists: enum Tree{OAK,MAPLE,PINE} What will the following code display? System.out.println(Tree.OAK);

OAK

If you have defined a class SavingsAccount with a public static method getNumberOfAccounts, and created a SavingsAccount object referenced by the variable account20, which of the following will call the getNumberOfAccounts method?

SavingsAccount.getNumberOfAccounts();

+equals(object2:Stock) : boolean This is a publi method that accepts a _____ object as its argument and returns a ______ value. (separate answers with comma)

Stock, boolean

Look at the following declaration: enum Tree{OAK,MAPLE,PINE} What is the fully-qualified name of the PINE enum constant?

Tree.PINE

When a method's return type is an object, what is actually returned to the calling program?

a reference to an object of that class

A static field is created by placing the key word static before/after the access specifier and before the field's data type

after

When a method in the ________ class returns a reference to a field object, it should return a reference to a copy of the field object to prevent "security holes."

aggregate

A static field is created by placing the key word static after the access specifier and before/after the field's data type.

before

After the header, the body of the method appears inside a set of ________.

braces

You cannot use the fully-qualified name of an enum constant for a ______ expression

case

A constructor has the same name as the _____.

class

One or more objects may be created from a(n)

class

To indicate the data type of a variable in a UML diagram, you specify the variable name followed by a _____ and the data type.

colon

To indicate the data type of a variable in a UML diagram, you specify the variable name followed by a colon and the _____ _____.

data type

When you make a copy of the aggregate object and of the objects it references, you are performing a

deep copy

+setHeight(h : double) : void The above means that a public method with a parameter of data type ________ that does not return a value

double

A declaration for an enumerated type begins with this key word.

enum

You can use the ______ key word to both create your own data type and specify the values that belong to that type

enum

You may use this to compare two enum data values.

equals and compareTo methods

import java.util.Scanner; is an example of an _______ import statement.

explicit

A method that gets a value from a class's field but does not change it is known as a mutator method. (true/false)

false

The java.lang package needs to be manually imported into Java programs. (true/false)

false

The names of the enum constants in an enumerated data type must be enclosed in quotation marks. (true/false)

false

The public access specifier for a field indicates that the field may not be accessed by statements outside the class. (true/false)

false

The term "default constructor" is applied to the first constructor written by the author of the class. (true/false)

false

When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable. (true/false)

false

You can declare an enumerated data type inside of a method. (true/false)

false

The JVM periodically performs this process to remove unreferenced objects from memory.

garbage collection

"________" is the term for the relationship created by object aggregation.

has a

Assume the class BankAccount has been created, and the following statement correctly creates an instance of the class: BankAccount account = new BankAccount(5000.0); What is true about the following? System.out.println(account); The account object's toString method will _______ be called

implicitly

You use this key word to import a class.

import

A class that is defined inside of another class is called a(n)

inner class

Another term for an object of a class is a(n)

instance

Another term for an object of a class is a(n) ________.

instance

When an object is created, the attributes associated with the object are called

instance fields

Methods that operate on an object's fields are called

instance methods

The key word this is the name of a reference variable that an object can use to refer to ______.

itself

If object1 and object2 are objects of the same class, to make object2 a copy of object1, write a _______ for the class that will make a field by field copy of object 1 data members into object 2's data members.

method

A method's signature consists of the

method name and parameter list

Class objects normally have ________ that perform useful operations on their data, but primitive variables do not.

methods

The only limitation that static methods have is they cannot refer to ________ members of the class.

nonstatic

By default, a reference variable that is an instance field is initialized to the value

null

UML diagrams do not contain

object names

In the blueprint/house analogy, think of a class as a blueprint that describes a house and ________ as instances of the house built from the blueprint.

objects

When a field is declared static, how many copies of the field will there be in memory?

one

Enumerated types have this method, which returns the position of an enum constant in the declaration list.

ordinal

________ is having two or more methods with the same name, but different signatures.

overloading

A group of related classes is called a(n)

package

Data hiding, which means that critical data stored inside the object is protected from code outside the object, is accomplished in Java by using the ______ access specifier on the class fields.

private

It is common practice in object-oriented programming to make all of a class's fields _______.

private

You should not define a class field that is dependent upon the values of other class fields in order to avoid having ____ _____.

stale data

What will be returned from the method, if the following is the method header? public Rectangle getRectangle()

the address of an object of the Rectangle class

A class's static methods do not operate on the fields that belong to any instance of the class. (true/false)

true

A constructor is a method that performs initialization or setup operations. (true/false)

true

A constructor is a method that is automatically called when an object is created. (true/false)

true

A method may have zero or more parameter variables. (true/false)

true

A method that stores a value in a class's field or in some other way changed the value of a field is known as a mutator method. (true/false)

true

An access specifier indicates how the class may be accessed. (true/false)

true

An enumerated data type is actually a special type of class. (true/false)

true

An instance of a class does not have to exist in order for values to be stored in a class's static fields. (true/false)

true

If a class has a method named finalize, it is called automatically just before an instance of the class is destroyed by the garbage collector. (true/false)

true

If you write a toString method for a class, Java will automatically call the method any time you concatenate an object of the class with a string. (true/false)

true

Shadowing is the term used to describe where the field name is hidden by the name of a local or parameter variable. (true/false)

true

The key word this is the name of a reference variable that an object can use to refer to itself. (true/false)

true

The scope of a local variable is the method in which they are defined. (true/false)

true

The term "no-arg constructor" is applied to any constructor that does not accept arguments. (true/false)

true

When an object is passed as an argument, it is actually a reference to the object that is passed. (true/false)

true

enum constants have a toString method. (true/false)

true

The "has a" relationship is sometimes called a(n) ________ because one object is part of a greater whole.

whole-part relationship

import java.util.*; The above is a ________ import statement.

wildcard

Which of the following is not involved in finding the classes when developing an object-oriented application?

write the code


Kaugnay na mga set ng pag-aaral

DRUGS, PHARMACOLOGICAL Therapy, IV Therapy

View Set

Adverse Effects of Blood Transfusion

View Set

Vocabulary Workshop Level E, Unit 6-10,

View Set

DECA Hospitality and Tourism Cluster - Performance Indicators (DETAILED)

View Set

Policy Provisions, Options and Riders

View Set

Bio 141 Ch3 Building Blocks of Life

View Set