Java 2 Test 1
Java automatically stores this value in all uninitialized static member variables:
0
When a method's return type is a class, what is actually returned to the calling program?
A reference to an object of that class
A class that is used for in-memory representation of images is
Image.
If a subclass constructor does not explicitly call a superclass constructor:
Java will automatically call the superclass's default or no-arg constructor just before the code in the subclass's constructor executes
A JavaFX control that displays text but does not otherwise interact with the user is provided by the class
Label
Replacing inadequate superclass methods with more suitable subclass methods is known as what?
Method overriding
The subclass of Parent that exposes a getChildren() method and allows child nodes to be added or removed is
Pane.
The ___________ control allows a user to enter a string in a single line of input into a JavaFX program.
Textfield
What will be returned from a method, if the following is the method header? public Rectangle getRectangle()
The address of an object of the class Rectangle
In an inheritance relationship:
The superclass constructor always executes before the subclass constructor
If the 'this' variable is used to call a constructor:
a compiler error will result, if it is not the first statement of the constructor
A JavaFX node that is not the parent of any other node is called
a leaf node.
In Java, it is possible to write a method that will return:
a. a whole number b. a monetary value c. a string of characters d. a reference to an object e. All of the above
A RadioButton control is a component that is
a. often used with a ToggleGroup object. b. used to select exactly one of a given group of options. c. All of the above.
If a class contains an abstract method:
a. you cannot create an instance of the class b. the method will have only a header, but not a body, and end with a semicolon c. the method must be overridden in subclasses d. All of the above
When an is a relationship exists between objects, it means that the specialized object has:
all the characteristics of the general object, plus additional characteristics
All fields declared in an interface:
are final and static
When a reference variable is passed as an argument to a method:
b. the method has access to the object that the variable references
For a local variable of a method to be accessible to a lambda expression, it must be
effectively final.
When a method is declared with the ________ modifier, it cannot be overridden in a subclass.
final
The term for the relationship created by object aggregation is:
has a
When one object is a specialized version of another object, there is this type of relationship between them.
is a
A JavaFX event
is an occurrence in the program that requires a method to be called in response.
A deep copy of an object:
is an operation that copies an aggregate object, and all the objects it references
The spacing around the outside of the border of a node is called
margin.
The super statement that calls the superclass constructor:
must be the first statement in the subclass's constructor
If you have defined a class named SavingsAccount with a public static data member named numberOfAccounts, and created a SavingsAccount object referenced by the variable account20, which of the following will assign numberOfAccounts to numAccounts?
numAccounts = SavingsAccount.numberOfAccounts;
You cannot use the == operator to compare the contents of:
objects
When we say that a scene graph node X is the parent of another scene graph node Y, we mean that
on the screen, the visual element corresponding to Y in nested in the visual element corresponding to X.
A subclass can directly access:
only public and protected members of the superclass
If two methods have the same name but different signatures, they are:
overloaded
If you do not provide an access specifier for a class member, the class member is given ________ by default.
package
The spacing just inside the border of a node that surrounds the node's content is called
padding.
When declaring class data members, it is best to declare them as:
private members
If ClassA extends ClassB, then:
public members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA
An object's ________ is simply the data that is stored in the object's fields at any given moment.
state
Static methods can only operate on ________ fields.
static
What key word can you use to call a superclass constructor explicitly?
super
A static field is created by placing
the key word static after the access specifier and before the field's data type
If a superclass does not have a default constructor or a no-arg constructor:
then a class that inherits from it, must call one of the constructors that the superclass does have.
The only limitation that static methods have is:
they cannot refer to non-static members of the class
The purpose of the start() method of the JavaFX Application class is
to assemble the user interfaced onto a stage, attach event handlers, and show the stage.
A CheckBox control is a component that is used
to select any number of a given group of options.
To compare two objects in a class:
write an equals method that will make a field by field compare of the two objects
The type of event that is generated when a user clicks a button is represented by the class
ActionEvent
A protected member of a class may be directly accessed by:
All of the above
Given the following code which of the following is TRUE? public class ClassB implements ClassA{}
ClassB must override each method in ClassA.
When a subclass overloads a superclass method:
Both methods may be called with a subclass object
If a scene graph node X is the parent of two other scene graph nodes Y and Z, then
X is a branch node.
If ClassC extends ClassB, which extends ClassA, this would be an example of:
a chain of inheritance