ADVANCED JAVA PART 6
101. Is "abc" a primitive value?
The String literal "abc" is not a primitive value.
It is a String object.
102. 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.
103. 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.
104. What modifiers may be used with an interface
declaration?
An interface may be declared as public or abstract.
105. Is a class a subclass of itself?
A class is a subclass of itself.
106. 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.
107. What event results from the clicking of a button?
The ActionEvent event is generated as the result of the
clicking of a button.
108. 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.
109. 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.
110. What advantage do Java's layout managers provide over
traditional windowing
systems?
Java uses layout managers to lay out components in a
consistent manner across all windowing
platforms. Since Java's layout managers aren't tied to
absolute sizing and positioning, they are able to
accomodate platform-specific differences among windowing
systems.
111. What is the Collection interface?
The Collection interface provides support for the
implementation of a mathematical bag - an
unordered collection of objects that may contain duplicates.
112. What modifiers can be used with a local inner class?
A local inner class may be final or abstract.
113. What is the difference between static and non-static
variables?
A static variable is associated with the class as a whole
rather than with specific instances of a class.
Non-static variables take on unique values with each object
instance.
114. What is the difference between the paint() and
repaint() methods?
The paint() method supports painting via a Graphics object.
The repaint() method is used to
causepaint() to be invoked by the AWT painting thread.
115. What is the purpose of the File class?
The File class is used to create objects that provide access
to the files and directories of a local file
system.
116. Can an exception be rethrown?
Yes, an exception can be rethrown.
117. Which Math method is used to calculate the absolute
value of a number?
The abs() method is used to calculate absolute values.
118. How does multithreading take place on a computer with a
single CPU?
The operating system's task scheduler allocates execution
time to multiple tasks. By quickly switching
between executing tasks, it creates the impression that
tasks execute sequentially.
119. When does the compiler supply a default constructor for
a class?
The compiler supplies a default constructor for a class if
no other constructors are provided.
120. When is the finally clause of a try-catch-finally
statement executed?
The finally clause of the try-catch-finally statement is
always executed unless the thread of execution
terminates or an exception occurs within the execution of
the finally clause.
No comments:
Post a Comment