Wednesday, 25 April 2012

JAVA interview questions 7

Q61. What is the catch or declare rule for methoddeclarations? 
If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause. 

Q62. What is the difference between a MenuItem and aCheckboxMenuItem? 
The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked. 

Q63. What is a task's priority and how is it used inscheduling? 
A task's priority is an integer value that identifies the relative order in which it should be 
executed with respect to other tasks. The scheduler attempts to schedule higher priority tasks before lower priority tasks. 

Q64. 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. 

Q65. When a thread is created and started, what is its initialstate? 
A thread is in the ready state after it has been created and started. 

Q66. Can an anonymous class be declared as implementingan interface and extending a class? 
An anonymous class may implement an interface or extend a superclass, but may not be declared to do both. 

Q67. What is the range of the short type? 
The range of the short type is -(2^15) to 2^15 - 1. 

Q68. What is the range of the char type? 
The range of the char type is 0 to 2^16 - 1. 

Q69. In which package are most of the AWT events thatsupport the event-delegation model defined? 
Most of the AWT-related events of the event-delegation model are defined in the 
java.awt.event package. The AWTEvent class is defined in the java.awt package. 

Q70. What is the immediate superclass of Menu? 

No comments:

Post a Comment