COSC 1437 CH3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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

Class

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

False

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

False

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

False

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

False

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

Methods

A constructor is a method that is automatically called when an object is created.

True

An access specifier indicates how the class may be accessed.

True

The java.lang package is automatically imported into all Java programs.

True

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

True

Which of the following is not involved in finding the classes 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 import 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 with 0.

A class's responsibilities include

both the things a class is responsible for knowing and the things a class is responsible for doing

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.

You use this key word to import a class.

import

You should not define a class field that is dependent upon 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.

A method

may have zero or more parameter variables.

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

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 they are 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.

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

+

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 that is written outside the Circle class.


Set pelajaran terkait

Colorado Life - The Exam Simulator

View Set

Which of the following are the end products for cellular respiration?

View Set

5300: Section 3 Introduction to Instructional Approaches

View Set

Lewis- Chapter 53: Female reproductive problems

View Set

THE KINGDOM UNDER SOLOMON QUIZ NO.2

View Set

Chapter 19: Public Goods and Common Resources

View Set

flexibility programming chapter 9... PART 1

View Set