Exam 8: A Second Look at Classes and Objects

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

If you write a toString method to display the contents of an object, object1, for a class, Class1, then the following two statements are equivalent: System.out.println(object1); System.out.println(object1.toString());

Free
(True/False)
4.9/5
(42)
Correct Answer:
Verified

True

In Java, it is possible to write a method that will return:

Free
(Multiple Choice)
4.8/5
(38)
Correct Answer:
Verified

E

Static methods can only operate on ________ fields.

Free
(Multiple Choice)
4.8/5
(39)
Correct Answer:
Verified

B

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

(Multiple Choice)
4.8/5
(37)

Java automatically stores this value in all uninitialized static member variables:

(Multiple Choice)
4.9/5
(36)

When a reference variable is passed as an argument to a method:

(Multiple Choice)
4.9/5
(32)

A single copy of a class's static field is shared by all instances of the class.

(True/False)
4.9/5
(34)

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

(Multiple Choice)
4.9/5
(47)

A class's static methods do not operate on the fields that belong to any instance of the class.

(True/False)
4.9/5
(33)

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?

(Multiple Choice)
5.0/5
(40)

When the this variable is used to call a constructor:

(Multiple Choice)
4.9/5
(39)

When a field is declared static, there will be:

(Multiple Choice)
4.9/5
(40)

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

(Multiple Choice)
4.8/5
(36)

If the this variable is used to call a constructor:

(Multiple Choice)
4.8/5
(32)

Look at the following declaration: enum Tree { OAK, MAPLE, PINE } What is the ordinal value of the MAPLE enum constant?

(Multiple Choice)
4.9/5
(39)

Enum constants have a toString method.

(True/False)
4.9/5
(34)

Which of the following is NOT true about static methods?

(Multiple Choice)
4.8/5
(38)

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

(Multiple Choice)
4.9/5
(38)

A static field is created by placing:

(Multiple Choice)
4.8/5
(33)

CRC stands for:

(Multiple Choice)
4.9/5
(46)
Showing 1 - 20 of 50
close modal

Filters

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