Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
41 Cards in this Set
- Front
- Back
In an inheritance relationship, what is the general class called?
|
superclass
|
|
In an inheritance relationship, what is the specialized class called?
|
subclass
|
|
This key word indicates that a class inherits ftom another class.
|
extends
|
|
A subclass does not have access to these superclass members.
|
private
|
|
This key word refers to an object's superclass.
|
super
|
|
In a subclass constructor, a call to the superclass constructor must appear where?
|
first statement
|
|
What is method overriding?
|
method in subclass has the same signature as method in superclass.
|
|
Write the first line of the definition for a Poodle class. The class should inherit from the Dog class.
|
public class Poodle extends Dog
|
|
Look at the following code which is the first line of a class definition:
public class Bear extends Animal In what order will the class constructors execute? |
Animal, then Bear
|
|
Write the statement that calls a superclass constructor and passes the arguments x, y, and z.
|
super(x, y, z);
|
|
A superclass has the following method:
public void setNumber (int n) { number = n; } Write a statement that can appear in a subclass that calls this method, passing 25 as an argument. |
setNumber(25);
|
|
Write the first line of the definition for a Stereo class. The class should inherit from the SoundSystem class and should implement the CDPlayable interface.
|
public class Stereo extends SoundSystem implements CDPlayable
|
|
______ variables are designed to hold only one value at a time.
|
Primitive
|
|
Arrays allow us to create a collection of like values that are _______.
|
indexed
|
|
An array can store any ________ but only one type of data at a time
|
type of data
|
|
An array is a list of _______.
|
data elements
|
|
An array is an object so it needs an ________.
|
object reference
int[] numbers; |
|
The array size must be a ____ number.
|
non-negative
|
|
An array is accessed by:
|
the reference name
a subscript that identifies which element in the array to access. |
|
The length of an array can be obtained via its ____ constant
|
length
ex: int size = temperatures.length; |
|
The return type of the method must be declared as an array of the right type.
|
public static double[] getArray()
{ double[] array = { 1.2, 2.3, 4.5, 6.7, 8.9 }; return array; } |
|
VERY IMPORTANT!!!!!!!!!!
The relationship between a superclass and an inherited class is called an _______. |
“is a” relationship
|
|
We can _______ the capabilities of a class
|
extend
|
|
Inheritance involves a _______ and a subclass
|
superclass
|
|
The subclass is based on, or _______ from, the superclass.
|
extended
|
|
The relationship of classes can be thought of as parent ______ and _________.
|
classes and child classes
|
|
The subclass inherits fields and methods from the superclass without any of them being _______.
|
rewritten
|
|
The Java keyword, _______, is used on the class header to define the subclass.
|
extends
ex: public class FinalExam extends GradedActivity |
|
Members of the superclass that are marked _____
-are not inherited by the subclass |
private
|
|
Members of the superclass that are marked _______.
-are inherited by the subclass |
public
|
|
Constructors are ________.
|
not inherited
|
|
When a subclass is instantiated, the _______ _______ constructor is executed first.
|
superclass default
|
|
The _______ keyword refers to an object’s superclass.
|
super
|
|
The subclass method overrides the superclass method.
This is known as _________. |
method overriding
|
|
The class StringTokenizer is in the _____ package.
|
java.util
|
|
the constructor method:
|
public StringTokenizer (String theString)
StringTokenizer tokens = new StringTokenizer(line) |
|
Constructor for a tokenizer that will use the characters in the string delimiters as separators when finding tokens in theString:
|
StringTokenizer tokens = new StringTokenizer(line, “,-”)
|
|
Returns true if there are more tokens in theString; returns false otherwise.
|
public boolean hasMoreTokens()
|
|
Returns the next token from theString
|
public String nextToken()
|
|
Returns the number of tokens remaining to be returned by nextToken
|
public int countTokens()
|
|
In each of the following statements us in the StringTokenizer class, how many tokens would be returned?
String line = “Ed’s ID# is 234-61-9876!”; a. StringToken tokens = new StringTokenizer(line, “-”) b. StringToken tokens = new StringTokenizer(line, “#-”) c. StringToken tokens = new StringTokenizer(line, “#’-”) |
a. 3
b. 4 c. 5 |