Displaying Page (2) of (5) | Total FAQ's Found : (135) |
Back | Next |
31) | What is the difference between a MenuItem and a CheckboxMenuItem? |
| The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.
|
32) | What class is the top of the AWT event hierarchy? |
| The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy. |
33) | When a thread is created and started, what is its initial state? |
| A thread is in the ready state after it has been created and started. |
34) | What is the purpose of finalization? |
| The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected. |
35) | What invokes a thread's run method? |
| After a thread is started, via its start method or that of the Thread class, the JVM invokes the thread's run method when the thread is initially executed. |
36) | What is the purpose of the finally clause of a try-catch-finally statement? |
| The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught. |
37) | What must a class do to implement an interface? |
| It must provide all of the methods in the interface and identify the interface in its implements clause |
38) | What method is invoked to cause an object to begin executing as a separate thread? |
| The start method of the Thread class is invoked to cause an object to begin executing as a separate thread. |
39) | What is the advantage of the event-delegation model over the earlier event-inheritance model? |
| The event-delegation model has two advantages over the event-inheritance model. First, it enables event handling to be handled by objects other than the ones that generate the events or their containers. This allows a clean separation between a component's design and its use. The other advantage of the event-delegation model is that it performs much better in applications where many events are generated. This performance improvement is due to the fact that the event-delegation model does not have to repeatedly process unhandled events, as is the case of the event-inheritance model. |
40) | What is an object's lock and which object's have locks? |
| An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object. |
41) | How are the elements of a BorderLayout organized? |
| The elements of a BorderLayout are organized at the borders North, South, East, and West and the center of a container. |
42) | When can an object reference be cast to an interface reference? |
| An object reference be cast to an interface reference when the object implements the referenced interface. |
43) | What is the difference between a Window and a Frame? |
| The Frame class extends Window to define a main application window that can have a menu bar.
|
44) | Can an object be garbage collected while it is still reachable? |
| A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected.. |
45) | What happens when a thread cannot acquire a lock on an object? |
| If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available. |
46) | What is the difference between the Reader/Writer class hierarchy and the |
| The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented. |
47) | What classes of exceptions may be caught by a catch clause? |
| A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types. |
48) | If a class is declared without any access modifiers, where may the class be accessed? |
| A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.
|
49) | What is the Map interface? |
| The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.
|
50) | Does a class inherit the constructors of its superclass? |
| A class does not inherit constructors from any of its superclasses. |
51) | For which statements does it make sense to use a label? |
| The only statements for which it makes sense to use a label are those statements that can enclose a break or continue statement.
|
52) | What is the purpose of the System class? |
| The purpose of the System class is to provide access to system resources. |
53) | Which TextComponent method is used to set a TextComponent to the read-only state? |
| setEditable |
54) | How are the elements of a CardLayout organized? |
| The elements of a CardLayout are stacked, one on top of the other, like a deck of cards. |
55) | Name the eight primitive Java types? |
| The eight primitive types are byte, char, short, int, long, float, double, and boolean. |
56) | Which class should you use to obtain design information about an object? |
| The Class class is used to obtain information about an object's design.
|
57) | What is the relationship between clipping and repainting? |
| When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
|
58) | What is the relationship between an event-listener interface and an event-adapter class? |
| An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface. |
59) | What restrictions are placed on the values of each case of a switch statement? |
| During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value. |
60) | What modifiers may be used with an interface declaration? |
| An interface may be declared as public or abstract.
|
Pages ( 1 | 2 | 3 | 4 | 5 ) |