xdxdxdxd Housh

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

What is returned by the following code? int cube(int x) { x = 3; return x * x * x; }

27

If a class is named Student, then every constructor would be named ___.

Student

Suppose you have a class called Turtle. What coding would create a new Turtle object?

Turtle turtlename = new Turtle ();

What is this code missing? double doIt(double x) { while (x>0) x -= 3; }

a return statement

A(n) ___ is a piece of information passed to a method.

actual parameter

The values passed to a method when it is called are...

actual parameters

A(n) ___ is a class method that is called when you create an object of the class using new.

constructor

The term ___ describes the process of combining an object's data and behavior into a single software entity and the details of implementation are hidden.

encapsulation

t/f? A variable declared in one method may be used in any other method in the same class.

false

t/f? Constructors should always return void.

false

t/f? Every method must have a return statement.

false

t/f? Methods that provide services to clients should be made private.

false

t/f? Only one object may be created from a particular class.

false

t/f? Parameters to methods may only be primitive types.

false

The parameters coded within the parentheses in a method's definition are called...

formal parameters

Small, usually private, methods defined within a class to assist in some processing required for the class are referred to as...

helper methods

Object is to class as...

house is to blueprint

A variable declared within a method is called a ___ variable.

local

A(n) ___ is an action that a Java object can perform.

method

Method overloading refers to...

more than one method with the same name

Methods in a class definition that are used to change the state of an object are called...

mutators

Within a class the use of two or more methods with the same name but different signatures is called method ___.

overloading

Instance variables for Java classes are nearly always declared to be ___.

private

If a method for a class needs to be visible to clients of the class, the method should be coded using the ___ modifier.

public

What should be used for services that an object provides to client code?

public methods

Assuming the existence of a class named Car, the variable car1 in the program statement: car1 = new Car(); is actually a(n) ___ to a Car object and is not an object itself.

reference

What characteristic of an object distinguishes that object from all other objects in the same program?

state

When a Coin object is passed to the println method,

the toString method is called on the object to get the string to print

t/f? A constructor must have the same name as its class.

true

t/f? An object may be made up of other objects.

true

t/f? Instance variables that are declared public violate the principle of encapsulation.

true

t/f? Overloaded methods have a signature, which includes the number, type, and order of parameters.

true

What term is used to describe the class definition statement keywords public and private?

visibility modifiers


Kaugnay na mga set ng pag-aaral

Chapter 15 Alabama State Insurance Law(code)

View Set

Pelvic girdle: Bones & ligaments

View Set

Strategic and Entrepreneurial Thinking Final

View Set

Auxiliary Verbs "Be," "Do," "Have"

View Set

Brandman - Quantitative Literacy Level A

View Set