What are synchronized methods and synchronized statements?
Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method’s object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread [...]
Can a top level class be private or protected?
No. A top level class can not be private or protected. It can have either “public” or no modifier. If it does not have a modifier it is supposed to have a default access.If a top level class is declared as private the compiler will complain that [...]
What is Data Access Object pattern?
The Data Access Object (or DAO) pattern: separates a data resource’s client interface from its data access mechanisms adapts a specific data resource’s access API to a generic client interface
The DAO pattern allows data access mechanisms to change independently of the code that uses the data.
The DAO implements the access [...]
What are the two basic ways in which classes that can be run as threads may be defined?
A thread class may be declared as a subclass of Thread, or it may implement the Runnable interface.
What is the difference between an if statement and a switch statement?
The if statement is used to select among two alternatives. [...]
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 [...]
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” [...]
Can an object’s finalize() method be invoked while it is reachable?
An object’s finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object’s finalize() method may be invoked by other objects.
What is the immediate superclass of the Applet class?
Panel
What is the difference between preemptive scheduling and time slicing?
Under [...]
What is the difference between final, finally and finalize?
final is used for making a class no-subclassable, and making a member variable as a constant which cannot be modified. finally is usually used to release all the resources utilized inside the try block. All the resources present in the finalize method will be garbage collected whenever [...]
What is the difference between final, finally and finalize?
Short answer:
final – declares constant
finally – relates with exception handling
finalize – helps in garbage collection
If asked to give details, explain:
final field, final method, final class
try/finally, try/catch/finally
protected void finalize() in Object class
What kind of security tools are available in J2SE 5.0?
There are three tools that can be used [...]
In System.out.println(),what is System,out and println,pls explain?
System is a predefined final class,out is a PrintStream object acting as a field member and println is a built-in overloaded method in the out object.
Can you write a Java class that could be used both as an applet as well as an application?
A. Yes. Add a main() [...]