Exam 4: Defining Classes I

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Mutator methods can return integer values indicating if the change of the instance variable was a success.

(True/False)
4.9/5
(25)

In a method invocation,there must be exactly the same number of arguments in parentheses as there are formal parameters in the method definition heading.

(True/False)
5.0/5
(28)

When you give a command to run a Java program,the runtime system invokes the class constructor.

(True/False)
4.9/5
(33)

Method overloading is when two or more methods of the same class have the same name but differ in number or types of parameters.

(True/False)
4.9/5
(34)

Write a method called Greeting that displays a personalized greeting given a first name.

(Essay)
4.8/5
(34)

Write a Java method that returns the value of PI,where PI = 3.1415926535.

(Essay)
4.9/5
(43)

The modifier private means that an instance variable can be accessed by name outside of the class definition.

(True/False)
4.7/5
(38)

An object of class A is an instance of class A.

(True/False)
4.8/5
(33)

What is the purpose of the new operator?

(Essay)
4.9/5
(38)

Write a method called isEqual that returns a Boolean value.The method compares two integers for equality.

(Essay)
4.9/5
(37)

The new operator:

(Multiple Choice)
4.8/5
(32)

A variable whose meaning is confined to an object of a class is called:

(Multiple Choice)
4.8/5
(36)

Create a class named Appointment that contains instance variables startTime,endTime,dayOfWeek (valid values are Sunday through Saturday),and a date which consists of a month,day and year.All times should be in military time,therefore it is appropriate to use integers to represent the time.Create the appropriate accessor and mutator methods.

(Essay)
5.0/5
(37)

Discuss a situation in which it is appropriate to use the this parameter.

(Essay)
4.8/5
(35)

A more eloquent approach in implementing mutator methods is to return a ________ value.

(Multiple Choice)
4.8/5
(41)

A set method is:

(Multiple Choice)
4.8/5
(39)

The parameter this refers to

(Multiple Choice)
4.8/5
(41)

When you want the parameters in a method to be the same as the instance variables you can use the _____ parameter.

(Multiple Choice)
4.8/5
(27)

Write preconditions and postconditions for the power method you wrote in question #4.

(Essay)
4.8/5
(44)

In Java,a block is delimited by:

(Multiple Choice)
4.8/5
(35)
Showing 21 - 40 of 44
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)