Translate

Thursday, September 6, 2012

ADVANCED JAVA PART 8


ADVANCED JAVA PART 8


141. What are the legal operands of the instanceof operator?

The left operand is an object reference or null value and the right operand is a class, interface,

or arraytype.

142. How are the elements of a GridBagLayout organized?

The elements of a GridBagLayout are of equal size and are laid out using the squares of a grid.

143. What an I/O filter?

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in

some way as it is passed from one stream to another.

144. If an object is garbage collected, can it become reachable again?

Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.

145. What is the Set interface?

The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do

not allow duplicate elements.

146. What classes of exceptions may be thrown by a throw statement?

A throw statement may throw any expression that may be assigned to the Throwable type.

147. What are E and PI?

E is the base of the natural logarithm and PI is mathematical value pi.

148. Are true and false keywords?

The values true and false are not keywords.

149. What is a void return type?

A void return type indicates that a method does not return a value.

150. What is the purpose of the enableEvents() method?

The enableEvents() method is used to enable an event for a particular object. Normally, an event

is enabled when a listener is added to an object for a particular event.

The enableEvents() method is used by objects that handle events by overriding their eventdispatch

methods.

151. What is the difference between the File and RandomAccessFile classes?

The File class encapsulates the files and directories of the local file system.

The RandomAccessFile class provides the methods needed to directly access data contained in any

part of a file.

152. What happens when you add a double value to a String?

The result is a String object.

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

154. Which package is always imported by default?

The java.lang package is always imported by default.

155. What interface must an object implement before it can 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.

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

157. What is a compilation unit?

A compilation unit is a Java source code file.

158. What interface is extended by AWT event listeners?

All AWT event listeners extend the java.util.EventListener interface.

159. 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 thrown by the overridden

method.

160. How can a dead thread be restarted?

A dead thread cannot be restarted.

No comments:

Post a Comment