|
|
Java Interview Questions
|
|
Java, the language, is a high-level object-oriented programming language, influenced in various ways by C, C++, and Smalltalk, with ideas borrowed from other languages as well (see O'Reilly's History of Programming Languages). Its syntax was designed to be familiar to those familiar with C-descended "curly brace" languages, but with arguably stronger OO principles than those found in C++, static typing of objects, and a fairly rigid system of exceptions that require every method in the call stack to either handle exceptions or declare their ability to throw them. Garbage collection is assumed, sparing the developer from having to free memory used by obsolete objects.
|
|
|
| |
Java FAQs - 1 |
Java FAQs - 2 |
Java FAQs - 3 |
Java FAQs - 4 |
Java FAQs - 5
Java FAQs - 6 |
Java FAQs - 7 |
Java FAQs - 8 |
Java FAQs - 9 |
Java FAQs - 10
|
|
|
Core Java Interview Questions - Part9
151. How are the elements of a GridLayout organized?
The elements of a GridBad layout are of equal size and are laid out using the
squares of a
grid.
152. 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.
153. 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.
154. 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.
155. 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.
156. What are E and PI?
E is the base of the natural logarithm and PI is mathematical value pi.
157. Are true and false keywords?
The values true and false are not keywords.
158. What is a void return type?
A void return type indicates that a method does not return a value.
159. 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.
160. 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.
161. What happens when you add a double value to a String?
The result is a String object.
162. 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..
163. Which package is always imported by default?
The java.lang package is always imported by default.
164. 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.
165. 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.
166. 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.
167. What is a compilation unit?
A compilation unit is a Java source code file.
168. What interface is extended by AWT event listeners?
All AWT event listeners extend the java.util.EventListener interface.
169. 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.
170. How can a dead thread be restarted?
A dead thread cannot be restarted.
171. What happens if an exception is not caught?
An uncaught exception results in the uncaughtException() method of the thread's
ThreadGroup being invoked, which eventually results in the termination of the
program
in which it is thrown.
172. What is a layout manager?
A layout manager is an object that is used to organize components in a
container.
173. Which arithmetic operations can result in the throwing of an
ArithmeticException?
Integer / and % can result in the throwing of an ArithmeticException.
174. What are three ways in which a thread can enter the waiting state?
A thread can enter the waiting state by invoking its sleep() method, by blocking
on I/O,
by unsuccessfully attempting to acquire an object's lock, or by invoking an
object's wait()
method. It can also enter the waiting state by invoking its (deprecated)
suspend() method.
175. Can an abstract class be final?
An abstract class may not be declared as final.
java6 ejb3 jsf hibernate eclipse ajax groovy spring seam java struts webservice j2me guice java5 jca tapestry soa linux ria books
|
|