< 1 2 3 4 5 6 7 > >>   Sort: Date

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, 6169👍, 0💬

Infinite Loops
How can you write a loop indefinitely? Two examples are listed in the following code: for(;;) { ... } while(true) { ... }
2007-03-03, 6168👍, 0💬

Vector and ArrayList Classes
What is the main difference between a Vector and an ArrayList? Java Vector class is internally synchronized and ArrayList is not.
2007-03-03, 6119👍, 0💬

Virtual Functions in Java
Can you have virtual functions in Java? Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has on...
2007-03-03, 6037👍, 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, 5993👍, 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, 5867👍, 0💬

Native Method
What is a native method? A native method is a method that is implemented in a language other than Java.
2007-03-03, 5716👍, 0💬

What is encapsulation technique
What is encapsulation technique? Hiding data within the class and making it available only through the methods. This technique is used to protect your class against accidental changes to fields, which might leave the class in an inconsistent state.
2007-11-16, 5547👍, 0💬

What is Java
What is Java? Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that ...
2007-03-03, 5499👍, 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, 5451👍, 0💬

Garbage Collection
Does garbage collection guarantee that a program will not run out of memory? No, it doesn't. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.
2007-03-03, 5388👍, 0💬

What is Collection API
What is Collection API? The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables. Example of classes: HashSet, HashMap, ArrayList, L...
2007-03-03, 5343👍, 0💬

What is the difference between a NULL pointer and a void pointer
What is the difference between a NULL pointer and a void pointer? A NULL pointer is a pointer of any type whose value is zero. A void pointer is a pointer to an object of an unknown type, and is guaranteed to have enough bits to hold a pointer to any object. A void pointer is not guaranteed to have ...
2007-11-13, 5321👍, 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, 5306👍, 0💬

Component Subclasses in Swing Package
Name Component subclasses that support painting? The Canvas, Frame, Panel, and Applet classes support painting.
2007-03-03, 5287👍, 0💬

Differences between Interfaces and Abstract Classes
What's the difference between an interface and an abstract class? An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implemen...
2007-03-03, 5283👍, 0💬

Wrapped Classes
What are wrapped classes? Wrapped classes are classes that allow primitive types to be accessed as objects.
2007-03-03, 5252👍, 0💬

What are the seven layers(OSI model) of networking
What are the seven layers(OSI model) of networking? 1.Physical, 2.Data Link, 3.Network, 4.Transport, 5.Session, 6.Presentation and 7.Application Layers.
2007-11-12, 5247👍, 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, 5234👍, 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, 5227👍, 0💬

Defining an Interface
How to define an Interface? Java Interface defines methods but does not implement them. Interface can include constants. A class that implements an interface is required to implement all the methods defined in the interface. Here is an example of interface definition: public interface MyInterface { ...
2007-03-03, 5208👍, 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, 5198👍, 0💬

Serializable Interface
How many methods in the Serializable interface? There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.
2007-03-03, 5193👍, 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, 5172👍, 0💬

< 1 2 3 4 5 6 7 > >>   Sort: Date