1⟩ What is a transient variable?
A transient variable is a variable that may not be serialized.
“Learn Basic Java programming with Interview Questions and Answers and examples.”
A transient variable is a variable that may not be serialized.
Yes, a lock can be acquired on a class. This lock is acquired on the class’s Class object.
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 has acquired the lock for the object or class referenced in the synchronized statement.
The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
The window, Frame and Dialog classes use a border layout as their default layout in Java Programming.
Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object’s lock, or by invoking an object’s wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often causes dirty data and leads to significant errors.
The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.
A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.
The purpose of the Runtime class is to provide access to the Java runtime system in Java Programming.
The Class class is used to obtain information about an object’s design.
The SimpleTimeZone class provides support for a Gregorian calendar in Java Programming.
validate();
Container method is used to cause a container to be laid out and redisplayed in Java Programming
The GregorianCalendar provides support for traditional Western calendars in Java Programming.
If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.
Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.
Object class is the superclass for every class in Java Programming
After a thread is started, via its start() method or that of the Thread class, the JVM invokes the thread’s run() method when the thread is initially executed.
An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
for(;;)–for loop; while(true)–always true, etc.