CS 120 Ch 3

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which symbol indicates that a member is public in a UML diagram?

+

Which symbol indicates that a member is private a UML diagram?

-

T/F: A method that gets a value from a class's field but does not change it is known as a mutator method.

F

T/F: The public access specifier for a field indicates that the field may not be accessed by statements outside the class.

F

T/F: The term "default constructor" is applied to the first constructor written by the author of the class.

F

T/F: When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable.

F

T/F: "Shadowing" is the term used to describe how the field name is hidden by the name of a local or parameter variable.

T

T/F: A constructor is a method that is automatically called when an object is created.

T

T/F: A method that stores a value in a class's field or in some other way changes the value of a field is known as a mutator method.

T

T/F: An access specifier indicates how a class may be accessed.

T

T/F: The java.lang package is automatically imported into all Java programs.

T

T/F: The term "no-arg constructor" is applied to any constructor that does not accept arguments.

T

For the following code, which statement is not true? public class Circle { private double radius; public double x; private double y; }

The y field is available to code written outside the Circle class

For the following code, which statement is not true? public class Sphere { private double radius; public double x; private double y; private double z; }

The z field is available to code written outside the Sphere class

Which of the following is not involved in identifying the classes to be used when developing an object-oriented application?

Write the code.

What does the following UML diagram entry mean? + setHeight(h : double) : void

a public method with a parameter of data type double that does not return a value

What is the following statement an example of? import java.util.*;

a wildcard important statement

What is the following statement an example of? import java.util.Scanner;

an explicit import statement

If you do not provide initialization values for a class's numeric fields, they will

be automatically initialized to 0

A class's responsibilities include

both of these.

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

braces { }

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

class

The key word new

creates an object in memory.

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

fields private

A constructor

has the same name as the class

Which is the key word used to import a class?

import

You should not define a class that is dependent on the values of other class fields

in order to avoid having stale data.

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

A method

may have zero or more parameters.

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

methods

UML diagrams do not contain

object names

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

objects

A group of related classes is called a(n)

package

A constructor is a method that

performs initialization or setup operations.

The scope of a local variable is

the method in which it is defined.

When an argument is passed by value

the parameter variable holds the address of the argument.

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.

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 private access specifier on the class fields


Conjuntos de estudio relacionados

Life and Health License - IL (Chapter 3)

View Set

5 functions of the cell membrane

View Set

CH 6 (Radiation Therapy Equipment and QA)

View Set

Quiz: Administering an Intradermal Injection

View Set

WHAPM Midterm Unit 0 and 1 Questions

View Set