<< < 21 22 23 24 25 26 27 >   Sort: Rank

Vector Class
What is the Vector class? The Vector class provides the capability to implement a growable array of objects
2007-03-03, 4680👍, 0💬

NullPointerException on String Objects
What can go wrong if you replace &emp;&emp; with &emp; in the following code: String a=null; if (a!=null &amp;&amp; a.length()&gt;10) { ... } A single ampersand here would lead to a NullPointerException.
2007-03-03, 4753👍, 0💬

Inner Class Declared inside a Method
Can an inner class declared inside of a method access local variables of this method? It's possible if these variables are final.
2007-03-03, 4731👍, 0💬

Differences between Process and Thread
What is the difference between Process and Thread? A process can contain multiple threads. In most multithreading operating systems, a process gets its own memory address space; a thread doesn't. Threads typically share the heap belonging to their parent process. For instance, a JVM runs in a single...
2007-03-03, 4689👍, 0💬

Acquiring a Lock on an Object
What happens when a thread cannot acquire a lock on an object? If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.
2007-03-03, 4806👍, 0💬

sleep() and yield() Methods
What is the difference between yielding and sleeping? When a thread invokes its yield() method, it returns to the ready state. When a thread invokes its sleep() method, it returns to the waiting state.
2007-03-03, 5501👍, 0💬

States of a Thread
What are the high-level thread states? The high-level thread states are ready, running, waiting, and dead.
2007-03-03, 6266👍, 0💬

wait(), notify() and notifyAll() Methods
What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other.
2007-03-03, 6272👍, 0💬

Invoking run() Method of a Thread
What invokes a thread's run() method? After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.
2007-03-03, 6265👍, 0💬

Order of Exception Catch Clauses
Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written? Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.
2007-03-03, 6332👍, 0💬

List of Waiting Threads on an Object
Can each Java object keep track of all the threads that want to exclusively access to it?
2007-03-03, 6939👍, 0💬

Locking Objects for Exclusive Use
Can Java object be locked down for exclusive use by a given thread? Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.
2007-03-03, 6752👍, 0💬

Multi-Threading
How does multi-threading 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.
2007-03-03, 7728👍, 0💬

What Is Thread
What is thread? A thread is an independent path of execution in a system.
2007-03-03, 7607👍, 0💬

equals() - String Comparison
What would you use to compare two String variables - the operator == or the method equals()? You can use operator == and method equals() for different types of comparisons: Using operator == to compare two string variables to see if they point the same String object. Using equals() to compare two st...
2007-03-03, 6267👍, 0💬

J2SDK 1.5 and J2SDK 5.0
What's the difference between J2SDK 1.5 and J2SDK 5.0? There is no difference, Sun Microsystems just re-branded this version.
2007-03-03, 6724👍, 0💬

Acquiring Locks on Classes
Can a lock be acquired on a class? Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
2007-03-03, 5271👍, 0💬

Waiting State in a Thread
What are three ways in which a thread can enter the waiting state? A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, 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 invoki...
2007-03-03, 5909👍, 0💬

Synchronized Methods and Synchronized Statements
What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to a method or 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 s...
2007-03-03, 5343👍, 0💬

Importance of Synchronization
What is synchronization and why is it important? 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...
2007-03-03, 6044👍, 0💬

Observer Interface and Observable Class
How are Observer and Observable used? 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 obj...
2007-03-03, 5233👍, 0💬

Transient Variables
What is a transient variable? A transient variable is a variable that may not be serialized. If you do not want some variables to be serialized, you can mark those variables transient or static.
2007-03-03, 5255👍, 0💬

Serializalble and Externalizable Interfaces
What is the difference between Serializalble and Externalizable interface? When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Extern...
2007-03-03, 5161👍, 0💬

Externalizable Interface: readExternal() and readExternal()
How many methods in the Externalizable interface? There are two methods in the Externalizable interface. You have to implement these two methods in order to make your class externalizable. These two methods are readExternal() and readExternal().
2007-03-03, 5203👍, 0💬

<< < 21 22 23 24 25 26 27 >   Sort: Rank