Chapter 9 Flashcards
To prevent a class from being instantiated, _____________________
use the private modifier on the constructor
Given the declaration Circle[] x = new Circle[10], which of the following statement is most accurate?
x contains a reference to an array and each element in the array can hold a reference to a Circle object.
Suppose the xMethod() is invoked from a main method in a class as follows, xMethod() is \_\_\_\_\_\_\_\_\_ in the class. public static void main(String[] args) { xMethod(); }
a static method
Given the declaration Circle x = new Circle(), which of the following statement is most accurate.
x contains a reference to a Circle object.
Variables that are shared by every instances of a class are __________.
class variables (AKA Static)
X Suppose the xMethod() is invoked in the following constructor in a class, xMethod() is \_\_\_\_\_\_\_\_\_ in the class. public MyClass() { xMethod(); }
a static method or an instance method
______ is a construct that defines objects of the same type.
A class
__________ represents an entity in the real world that can be distinctly identified.
An object
The keyword __________ is required to declare a class.
class
________ is invoked to create an object.
A constructor
You can declare two variables with the same name in __________.
different methods in a class
A method that is associated with an individual object is called __________.
an instance method
An object is an instance of a __________.
class
The default value for data field of a boolean type, numeric type, object type is ___________, respectively.
false, 0, null
To declare a constant MAX_LENGTH as a member of the class, you write
final static double MAX_LENGTH = 99.98;