- Home
- Interview Questions
- Core Java
11.
What are the methods used to get and set the text label on the Button ?
The following methods are used to get and set the text label
getLabel() and setLabel()
getLabel() and setLabel()
12.
Which method should be implemented by all threads?
All the tasks must be implement the run() method,even they are a subclass of Thread.
13.
when the unreachable object become reachable again?
The unreachable object can be reachable when the object's finalize() method is
invoked and the object performs an operation which causes it to become accessible and reachable the objects.
14.
A try statement determine which catch clause should be used to handle an exception How ?
When an exception is thrown within the body of a try statement, The catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.
15.
What is the main benefit of a statement block?
A statement block is used to organize a sequence of statements as a single statement group.
16.
What is the use of the System class?
The main use of the System class is to provide access to system resources.
17.
Define object's lock and which object's have locks?
An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object.
A thread may execute a synchronized method of an object only after it has acquired the object's lock.
All
objects and classes have locks. A class's lock is acquired on the class's Class object.
18.
Difference between the String and StringBuffer classes?
Yes. Add a main() method to the applet.
19.
What's the difference between constructors and other methods?
String objects are constants but a StringBuffer objects are not a constants.
20.
Relation between the Canvas class and the Graphics class?
A Canvas object provides access to a Graphics object via its paint() method.