<< < 7 8 9 10 11 12 13 14 15 16 17 > >>   Sort: Date

Two methods have key words static synchronized and synchronized separately. What is the difference between them?
Two methods have key words static synchronized and synchronized separately. What is the difference between them? Both are synchronized methods. One is instance method, the other is class method. Method with static modifier is a class method. That means the method belongs to class itself and can be a...
2012-08-30, 2239👍, 0💬

What is the relationship between the Canvas class and the Graphics class?
What is the relationship between the Canvas class and the Graphics class? A Canvas object provides access to a Graphics object via its paint() method.
2012-11-02, 2236👍, 0💬

What is the purpose of the finally clause of a try-catch-finally statement? garbage collector?
What is the purpose of the finally clause of a try-catch-finally statement? garbage collector? The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.
2012-10-23, 2236👍, 0💬

What is the difference between static and non-static variables?
What is the difference between static and non-static variables? A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.
2012-07-26, 2235👍, 0💬

Can a .java file contain more than one java classes?
Can a .java file contain more than one java classes? Yes, a .java file contain more than one java classes, provided at the most one of them is a public class.
2013-06-24, 2233👍, 0💬

What is an object's lock and which objects have locks?
What is an object's lock and which objects 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 lock...
2012-11-07, 2233👍, 0💬

What method is invoked to cause an object to begin executing as a separate thread?
What method is invoked to cause an object to begin executing as a separate thread? The start() method of the Thread class is invoked to cause an object to begin executing as a separate thread.
2012-10-29, 2232👍, 0💬

How can you write a loop indefinitely?
How can you write a loop indefinitely? for(;;)--for loop; while(true)--always true, etc.
2012-06-27, 2231👍, 0💬

This class (IncrementImpl) will be used by various threads concurrently; can you see the inherent flaw(s)? How would you improve
This class (IncrementImpl) will be used by various threads concurrently; can you see the inherent flaw(s)? How would you improve it? public class IncrementImpl { private static int counter = 0; public synchronized void increment() { counter++; } public int getCounter() { return counter; } } The coun...
2012-08-28, 2230👍, 0💬

What's the difference between constructors and other methods?
What's the difference between constructors and other methods? Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.
2012-08-27, 2230👍, 0💬

What is the difference between the paint() and repaint() methods?
What is the difference between the paint() and repaint() methods? The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
2012-07-26, 2229👍, 0💬

Can a for statement loop indefinitely?
Can a for statement loop indefinitely? Yes, a for statement can loop indefinitely. For example, consider the following: for(;;) ;
2012-10-09, 2228👍, 0💬

What interface must an object implement before it can be written to a stream as an object?
What interface must an object implement before it can be written to a stream as an object? An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.
2012-08-06, 2227👍, 0💬

What is the SimpleTimeZone class?
What is the SimpleTimeZone class? The SimpleTimeZone class provides support for a Gregorian calendar.
2012-07-04, 2227👍, 0💬

How can a GUI component handle its own events?
How can a GUI component handle its own events? A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.
2012-12-06, 2221👍, 0💬

What is the List interface?
What is the List interface? The List interface provides support for ordered collections of objects.
2012-09-24, 2221👍, 0💬

What's the difference between the methods sleep() and wait()
What's the difference between the methods sleep() and wait() The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in th...
2012-09-11, 2221👍, 0💬

What kind of security tools are available in J2SE 5.0?
What kind of security tools are available in J2SE 5.0? There are three tools that can be used to protect application working within the scope of security policies set at remote sites. keytool -- used to manage keystores and certificates. jarsigner -- used to generate and verify JAR signatures. polic...
2012-09-03, 2221👍, 0💬

How can you minimize the need of garbage collection and make the memory use more effective?
How can you minimize the need of garbage collection and make the memory use more effective? Use object pooling and weak object references.
2013-04-19, 2212👍, 0💬

What is the difference between shallow copy and deep copy?
What is the difference between shallow copy and deep copy? Shallow copy shares the same reference with the original object like cloning, whereas the deep copy get a duplicate instance of the original object. If the shallow copy has been changed, the original object will be reflected and vice versa.
2012-08-24, 2212👍, 0💬

What is the relationship between clipping and repainting?
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.
2012-11-30, 2209👍, 0💬

What is weak reference in Java
What is weak reference in Java A weak reference is one that does not prevent the referenced object from being garbage collected. You might use them to manage a HashMap to look up a cache of objects. A weak reference is a reference that does not keep the object it refers to alive. A weak reference is...
2012-09-10, 2209👍, 0💬

What event results from the clicking of a button?
What event results from the clicking of a button? The ActionEvent event is generated as the result of the clicking of a button.
2012-12-06, 2208👍, 0💬

What are the different types of inner classes?
What are the different types of inner classes? There are four different types of inner classes in Java. They are: a)Static member classes , a static member class has access to all static methods of the parent, or top-level, class b) Member classes, the member class is instance specific and has acces...
2012-09-07, 2206👍, 0💬

<< < 7 8 9 10 11 12 13 14 15 16 17 > >>   Sort: Date