Friday, 27 April 2012

JAVA interview questions 19

Q181. What happens when you add a double value to a String? 
The result is a String object. 

Q182. What is your platform's default character encoding? 
If you are running Java on English Windows platforms, it is probably Cp1252. If you are running Java on English Solaris platforms, it is most likely 8859_1.. 

Q183. Which package is always imported by default? 
The java.lang package is always imported by default. 

Q184. What interface must an object implement before itcan be written to a stream as an object? 
An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object. 

Q185. How are this and super used? 
this is used to refer to the current object instance. super is used to refer to the variables and methods of the superclass of the current object instance. 

Q186. What is the purpose of garbage collection? 
The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources may be reclaimed and reused. 

Q187. What is a compilation unit? 
A compilation unit is a Java source code file. 

Q188. What interface is extended by AWT event listeners? 
All AWT event listeners extend the java.util.EventListener interface. 

Q189. What restrictions are placed on method overriding? 
• Overridden methods must have the same name, argument list, and return type. 
• The overriding method may not limit the access of the method it overrides. 
• The overriding method may not throw any exceptions that may not be thrownby the overridden method. 

Q190. How can a dead thread be restarted? 
A dead thread cannot be restarted.

No comments:

Post a Comment