CH.10
assume that you have created a class named MyClass, and that a working program contains the following statement: output MyClass.numberOfStudents Which of the following do you know
numberOfStudents is a static field
Which of these does not belong with the others
object
a class diagram ___.
provides an overview of a class's data and methods
Every class definition must contain ______.
a name
An Object can be ____.
all of the above.
when discussing classes and objects, encapsulation meanst that
all the fields and methods are grouped together
assume that a working program contains the following statement: myDog.setName("Bowser") which of the following do you know
both of the above
A static method is also known as a(n) ____metod.
class
A program that instantiates objects of another prewritten class is a(n)
client
Which of the following means the same as instance variable?
field
assume that a working program contains the following statement: name = myDog.getName() Which of the following do you know?
getName() returns a value that is the same data type as name
Assume that you have created an object named myObject and that a working program contains the following statement: output myObject.getSize() Which of the following do you know?
getSize() receives a this reference
the porcoess of acquiring the traits of one's predecessors is
inheritance
Which of the following means the same as object?
instance
The relationship between an instance and a class is a(n) ___relationship
is-a
Which of the following is the mostlikely scenario for a specific class?
its data is private, and its methods are public
Assume that you hav ecreated a class that contains a private field named myField and a nonstatic public method named myMethod(). Which of the following is true?
myMethod() has access to myField and can use it
By default, methods contained in a class are _____ methods
nonstatic
an instance method_____
receives a this reference
Assume that you ahve created a class named Dog that contains a data field named weight and an instance method named setWeight(). Further assume that the setWeight() method accepts a numeric parameter anmed weight. Which of the following statements correctly sets a Dog's weight within the setWeight() method?
this.weight = weight