|
1. Name two subclasses of the TextComponent class. TextField and TextArea 2. What is the difference between a static and a non-static inner class? A non-static inner class may have object instances that are associated with instances of the class's outer class. A static inner class does not have any object instances. 3. What is the purpose of the Runtime class? The purpose of the Runtime class is to provide access to the Java runtime system. 4. 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. 5. 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. 6. What is the Dictionary class? The Dictionary class provides the capability to store key-value pairs. 7. 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. 8. How can a GUI component handle its own events? A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener. 9. 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. 10. What is the difference between a break statement and a continue statement? A break statement results in the termination of the statement to which it applies (switch, for, do, or while). A continue statement is used to end the current loop iteration and return control to the loop statement. 11. What is an abstract method? An abstract method is a method whose implementation is deferred to a subclass. 12. 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. 13. 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. 14. Which class is extended by all other classes? The Object class is extended by all other classes. 15. What value does read() return when it has reached the end of a file? The read() method returns -1 when it has reached the end of a file.
|