|
Java Interview Questions and Answers
For which statements does it make sense to
use a label?
The only statements for which it makes sense to use a label are those
statements that can enclose a break or continue statement.
What is the purpose of the System class?
The purpose of the System class is to provide access to system
resources.
Which TextComponent method is used to set a TextComponent to the
read-only state?
setEditable()
How are the elements of a CardLayout organized?
The elements of a CardLayout are stacked, one on top of the other, like
a deck of cards.
Is &&= a valid Java operator?
No, it is not.
Name the eight primitive Java types.
The eight primitive types are byte, char, short, int, long, float,
double, and boolean.
Which class should you use to obtain design information about an
object?
The Class class is used to obtain information about an object's design.
What is the relationship between clipping and repainting?
When a window is repainted by the AWT painting thread, it sets the
clipping regions to the area of the window that requires repainting.
Is "abc" a primitive value?
The String literal "abc" is not a primitive value. It is a String
object. What is the relationship between an event-listener interface and an
event-adapter class?
An event-listener interface defines the methods that must be implemented
by an event handler for a particular kind of event. An event adapter
provides a default implementation of an event-listener interface.
What restrictions are placed on the values of each case of a switch
statement?
During compilation, the values of each case of a switch statement must
evaluate to a value that can be promoted to an int value.
What modifiers may be used with an interface declaration?
An interface may be declared as public or abstract.
Is a class a subclass of itself?
A class is a subclass of itself.
What is the highest-level event class of the event-delegation model?
The java.util.EventObject class is the highest-level class in the
event-delegation class hierarchy.
What event results from the clicking of a button?
The ActionEvent event is generated as the result of the clicking of a
button.
How can a GUI component handle its own events?
A component can handle its own events by implementing the required
event-listener interface and adding itself as its own event listener.
What is the difference between a while statement and a do statement?
A while statement checks at the beginning of a loop to see whether the
next loop iteration should occur. A do statement checks at the end of a
loop to see whether the next iteration of a loop should occur. The do
statement will always execute the body of a loop at least once.
How are the elements of a GridBagLayout organized?
The elements of a GridBagLayout are organized according to a grid.
However, the elements are of different sizes and may occupy more than
one row or column of the grid. In addition, the rows and columns may
have different sizes.
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
|