283.
Question: Is a class a subclass of itself?
284. Question: What is the highest-level event class of the event-delegation model?
285. Question: What event results from the clicking of a button?
286. Question: How can a GUI component handle its own events?
287. Question: What is the difference between a while statement and a dostatement?
288. Question: How are the elements of a GridBagLayout organized?
289. Question: What advantage do Java's layout managers provide over traditional windowing systems?
290. Question: What is the Collection interface?
291. Question: What modifiers can be used with a local inner class?
292. Question: What is the difference between static and non-static variables?
293. Question: What is the difference between the paint() and repaint() methods?
294. Question: What is the purpose of the File class?
295. Question: Can an exception be rethrown?
296. Question: Which Math method is used to calculate the absolute value of a number?
297. Question: How does multithreading take place on a computer with a single CPU?
298. Question: When does the compiler supply a default constructor for a class?
299. Question: When is the finally clause of a try-catch-finally statement executed?
300. Question: Which class is the immediate superclass of the Container class?
301. Question: If a method is declared as protected, where may the method be accessed?
302. Question: How can the Checkbox class be used to create a radio button?
303. Question: Which non-Unicode letter characters may be used as the first character of an identifier?
304. Question: What restrictions are placed on method overloading?
305. Question: What happens when you invoke a thread's interrupt method while it is sleeping or waiting?
306. Question: What is casting?
307. Question: What is the return type of a program's main() method?
308. Question: Name four Container classes.
309. Question: What is the difference between a Choice and a List?
310. Question: What class of exceptions are generated by the Java run-time system?
311. Question: What class allows you to read objects directly from a stream?
312. Question: What is the difference between a field variable and a local variable?
Answer :
A class is a subclass of itself284. Question: What is the highest-level event class of the event-delegation model?
Answer :
The java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.285. Question: What event results from the clicking of a button?
Answer :
The ActionEvent event is generated as the result of the clicking of a button286. Question: How can a GUI component handle its own events?
Answer :
A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener287. Question: What is the difference between a while statement and a dostatement?
Answer :
A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once288. Question: How are the elements of a GridBagLayout organized?
Answer :
The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes289. Question: What advantage do Java's layout managers provide over traditional windowing systems?
Answer :
Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accomodate platform-specific differences among windowing systems290. Question: What is the Collection interface?
Answer :
The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates291. Question: What modifiers can be used with a local inner class?
Answer :
A local inner class may be final or abstract292. Question: What is the difference between static and non-static variables?
Answer :
A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance293. Question: What is the difference between the paint() and repaint() methods?
Answer :
The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread294. Question: What is the purpose of the File class?
Answer :
The File class is used to create objects that provide access to the files and directories of a local file system295. Question: Can an exception be rethrown?
Answer :
Yes, an exception can be rethrown296. Question: Which Math method is used to calculate the absolute value of a number?
Answer :
The abs() method is used to calculate absolute values297. Question: How does multithreading take place on a computer with a single CPU?
Answer :
The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially298. Question: When does the compiler supply a default constructor for a class?
Answer :
The compiler supplies a default constructor for a class if no other constructors are provided299. Question: When is the finally clause of a try-catch-finally statement executed?
Answer :
The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause300. Question: Which class is the immediate superclass of the Container class?
Answer :
Component301. Question: If a method is declared as protected, where may the method be accessed?
Answer :
A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared302. Question: How can the Checkbox class be used to create a radio button?
Answer :
By associating Checkbox objects with a CheckboxGroup303. Question: Which non-Unicode letter characters may be used as the first character of an identifier?
Answer :
The non-Unicode letter characters $ and _ may appear as the first character of an identifier304. Question: What restrictions are placed on method overloading?
Answer :
Two methods may not have the same name and argument list but different return types305. Question: What happens when you invoke a thread's interrupt method while it is sleeping or waiting?
Answer :
When a task's interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown306. Question: What is casting?
Answer :
There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference307. Question: What is the return type of a program's main() method?
Answer :
A program's main() method has a void return type308. Question: Name four Container classes.
Answer :
Window, Frame, Dialog, File Dialog, Panel, Applet, or ScrollPane309. Question: What is the difference between a Choice and a List?
Answer :
A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items310. Question: What class of exceptions are generated by the Java run-time system?
Answer :
The Java runtime system generates Runtime Exception and Error exceptions311. Question: What class allows you to read objects directly from a stream?
Answer :
The ObjectInputStream class supports the reading of objects from input streams312. Question: What is the difference between a field variable and a local variable?
No Comment to " 30 Java Interview Questions and Answers "