226.
Question: Name three subclasses of the Component class.
227. Question: What is the GregorianCalendar class?
228. Question: Which Container method is used to cause a container to be laid out and redisplayed?
229. Question: What is the purpose of the Runtime class?
230. Question: How many times may an object's finalize() method be invoked by the garbage collector?
231. Question: What is the purpose of the finally clause of a try-catch-finally statement?
232. Question: What is the argument type of a program's main() method?
233. Question: Which Java operator is right associative?
234. Question: What is the Locale class?
235. Question: Can a double value be cast to a byte?
236. Question: What is the difference between a break statement and a continue statement?
237. Question: What must a class do to implement an interface?
238. Question: What method is invoked to cause an object to begin executing as a separate thread?
239. Question: Name two subclasses of the TextComponent class.
240. Question: What is the advantage of the event-delegation model over the earlier event-inheritance model?
241. Question: Which containers may have a MenuBar?
242. Question: How are commas used in the intialization and iterationparts of a for statement?
243. Question: What is the purpose of the wait(), notify(), and notifyAll() methods?
244. Question: What is an abstract method?
245. Question: How are Java source code files named?
246. Question: What is the relationship between the Canvas class and the Graphics class?
247. Question: What are the high-level thread states?
248. Question: What value does read() return when it has reached the end of a file?
249. Question: Can a Byte object be cast to a double value?
250. Question: What is the difference between a static and a non-static inner class?
251. Question: What is the difference between the String and StringBuffer classes?
252. Question: If a variable is declared as private, where may the variable be accessed?
253. Question: What is an object's lock and which object's have locks?
Answer :
Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, or TextComponent227. Question: What is the GregorianCalendar class?
Answer :
The GregorianCalendar provides support for traditional Western calendars228. Question: Which Container method is used to cause a container to be laid out and redisplayed?
Answer :
validate()229. Question: What is the purpose of the Runtime class?
Answer :
The purpose of the Runtime class is to provide access to the Java runtime system230. Question: How many times may an object's finalize() method be invoked by the garbage collector?
Answer :
An object's finalize() method may only be invoked once by the garbage collector231. Question: What is the purpose of the finally clause of a try-catch-finally statement?
Answer :
The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught232. Question: What is the argument type of a program's main() method?
Answer :
A program's main() method takes an argument of the String[] type233. Question: Which Java operator is right associative?
Answer :
The = operator is right associative234. Question: What is the Locale class?
Answer :
The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region235. Question: Can a double value be cast to a byte?
Answer :
Yes, a double value can be cast to a byte236. Question: What is the difference between a break statement and a continue statement?
Answer :
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 statement237. Question: What must a class do to implement an interface?
Answer :
It must provide all of the methods in the interface and identify the interface in its implements clause238. Question: What method is invoked to cause an object to begin executing as a separate thread?
Answer :
The start() method of the Thread class is invoked to cause an object to begin executing as a separate thread239. Question: Name two subclasses of the TextComponent class.
Answer :
TextField and TextArea240. Question: What is the advantage of the event-delegation model over the earlier event-inheritance model?
Answer :
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 model241. Question: Which containers may have a MenuBar?
Answer :
Frame242. Question: How are commas used in the intialization and iterationparts of a for statement?
Answer :
Commas are used to separate multiple statements within the initialization and iteration parts of a for statement243. Question: What is the purpose of the wait(), notify(), and notifyAll() methods?
Answer :
The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an object's wait() method, it enters the waiting state. It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods244. Question: What is an abstract method?
Answer :
An abstract method is a method whose implementation is deferred to a subclass245. Question: How are Java source code files named?
Answer :
A Java source code file takes the name of a public class or interface that is defined within the file. A source code file may contain at most one public class or interface. If a public class or interface is defined within a source code file, then the source code file must take the name of the public class or interface. If no public class or interface is defined within a source code file, then the file must take on a name that is different than its classes and interfaces. Source code files use the .java extension246. Question: What is the relationship between the Canvas class and the Graphics class?
Answer :
A Canvas object provides access to a Graphics object via its paint() method247. Question: What are the high-level thread states?
Answer :
The high-level thread states are ready, running, waiting, and dead248. Question: What value does read() return when it has reached the end of a file?
Answer :
The read() method returns -1 when it has reached the end of a file249. Question: Can a Byte object be cast to a double value?
Answer :
No, an object cannot be cast to a primitive value250. Question: What is the difference between a static and a non-static inner class?
Answer :
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 instances251. Question: What is the difference between the String and StringBuffer classes?
Answer :
String objects are constants. StringBuffer objects are not252. Question: If a variable is declared as private, where may the variable be accessed?
Answer :
A private variable may only be accessed within the class in which it is declared253. Question: What is an object's lock and which object's have locks?
No Comment to " 28 Java Interview Questions and Answers "