|
Java Interview Questions and Answers
What are E and PI?
E is the base of the natural logarithm and PI is mathematical value pi.
Are true and false keywords?
The values true and false are not keywords.
What is a void return type?
A void return type indicates that a method does not return a value.
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 event-dispatch methods.
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.
What happens when you add a double value to a String?
The result is a String object.
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..
Which package is always imported by default?
The java.lang package is always imported by default.
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.
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.
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.
What is a compilation unit?
A compilation unit is a Java source code file.
What interface is extended by AWT event listeners?
All AWT event listeners extend the java.util.EventListener interface.
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.
How can a dead thread be restarted?
A dead thread cannot be restarted.
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.
What is a layout manager?
A layout manager is an object that is used to organize components in a
container.
Which arithmetic operations can result in the throwing of an
ArithmeticException?
Integer / and % can result in the throwing of an ArithmeticException.
Page Numbers :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Structs Interview
Questions for more Structs Interview Questions with answers
|