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;
57 Cards in this Set
- Front
- Back
The collections framework algorithms are __________, i.e., each of these algorithms can operate on objects that offer given interfaces without concern to the underlying implementations. |
polymorphic |
|
|
9 |
|
|
Both (a) and (b) Must implement a method called calculate Will not be able to access the instance variable a |
|
In this question, assume a class, Book, has been defined. Which set of statements creates an array of Book objects? |
Book[] books;books = new Book[ numberElements ]; |
|
When a subclass constructor calls its superclass constructor, what happens if the superclass’s constructor does not assign a value to an instance variable? |
The program compiles and runs because the instance variables are initialized to their default values |
|
The preferred means of creating multithreaded Java applications is by implementing the ________ interface. An object of a class that implements this interface represents a task to perform. |
Runnable |
|
__________ enable programmers to specify, with a single method declaration, a set of related methods. |
Generic methods |
|
The import declaration import *; ________. |
causes a compilation error. |
|
Which of the following should usually be private? |
Variables (or fields) |
|
Attributes of a class are also known as: |
Fields |
|
Which of the following statements about the continue statement is true? |
A continue statement proceeds with the next iteration of the immediately enclosing while, for, do…while statement. |
|
Non-abstract classes are called: |
concrete classes |
|
|
This porridge is too hot. |
|
To exit out of a loop completely, and resume the flow of control at the next line in the method, use _______. |
A break statement. |
|
An uncaught exception: |
is an exception that occurs for which there are no matching catch clauses. |
|
When a __________ method or block is running on an object, the object is locked so no other such method can run on that object at the same time |
synchronized |
|
When no access modifier is specified for a method or variable, the method or variable: |
Has package access. |
|
Declaring main as ________ allows the JVM to invoke main without creating an instance of the class. |
static. |
|
Which statement best describes the relationship between superclass and subclass types? |
A subclass reference can be assigned to a superclass variable, but a superclass reference cannot be assigned to a subclass variable. |
|
Which superclass members are inherited by all subclasses of that superclass? |
protected instance variables and methods |
|
Declaring a method final means |
it cannot be overridden |
|
Which of the following is a valid fully qualified name? |
java.util.Scanner |
|
Which of the following statements about the break statement is false? |
The break statement, when executed in a while, for or do…while, skips the remaining statements in the loop body and proceeds with the next iteration of the loop |
|
Which of the following statements is false |
Information in the memory unit is persistent—it is retained when the computer's power is turned off. |
|
A(n) ________ enables a program to read data from the user. |
Scanner |
|
The control variable of a counter-controlled loop should be declared as ________to prevent errors. |
int |
|
|
0 |
|
|
"This porridge is too hot." "This porridge is just right." |
|
|
if ( gender == 1 && age >= 65 ) ++seniorFemales; |
|
Polymorphism enables you to: |
program in the general |
|
Polymorphism allows for specifics to be dealt with during: |
execution |
|
All of the following methods are implicitly final except: |
a method in an abstract class |
|
All exception classes inherit, either directly or indirectly, from: |
class Throwable |
|
The main method executes in the _____ thread of exectution |
main |
|
To catch an exception, the code that might throw the exception must be enclosed in a |
try block |
|
A new thread begins its life cycle by transitioning to the ____ state. |
new |
|
Which of the following statements about try blocks is true? |
The try block should contain statements that may throw an exception |
|
In the catch block below, what is arithmeticException? catch(ArithmeticException arithmeticException) { System.err.printf(arithmetricException); } // end catch |
The name of catch block's exception parameter |
|
Which of the following is not true of ExecutorService |
It is an object that can be run in a separate thread |
|
Collections method sort that accepts a List as an argument sorts the elements of a List, which must implement the _____ interface. |
Comparable |
|
When the compiler translates a generic method into Java bytecodes, it uses _____ to replace the type parameters with actual types. |
erasure |
|
Which statement is false? |
A List cannot contain duplicate elements |
|
When a generic class is instantiated without specifying a type argument, it is said to have a _______ |
raw type |
|
One generic Stack class could be the basis for creating many Stack classes, e.g., Stack, Stack and Stack. These classes are known as ________ |
parameterized classes |
|
A(n) _____ allows a program to walk through the collection and remove elements from the collection |
Iterator |
|
T/F: A non-generic class cannot be derived from a generic class |
False |
|
The classes and interfaces which comprise the collections framework are members of package |
java.util |
|
T/F: With datagram sockets a process establishes a connectino to another process |
False |
|
T/F: UDP is a connection-oriented protocol |
False |
|
A(n) _____ is thrown when a String that is not in proper URL format is passed to a URL constructor |
MalformedURLException |
|
A JEditorPane generates HyperlinkEvents only if it is _______ |
uneditable |
|
Once the ServerSocket is created, the server can listen indefinitely (or block) for an attempt by a client to connect. This is accomplished with a call to the ServerSocket method_____. |
accept |
|
Which statement is false? Normally, an applet ______ |
can read files on any server that can be reached over the network |
|
A(n) ______ is thrown when a server address indicated by a client cannot be resolved |
UnknownHostException |
|
Using a URL as an argument to the ______ method of interface AppletContext causes the browser to which an applet is executing to display the URL |
showDocument |
|
______ sockets and the ________ protocol are more desirable for the vast majority of Java programmers |
Stream, TCP |
|
If an ObjectInputStream is used to read information from the server, an ____ is generated when the client attempts to read a value from a stream on which end-of-stream is detected |
EOFException |