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

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

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

When can an object reference be cast to an interface reference?
When can an object reference be cast to an interface reference? An object reference can be cast to an interface reference when the object implements the referenced interface.
2012-07-13, 2477👍, 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, 2476👍, 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, 2474👍, 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, 2472👍, 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, 2471👍, 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, 2471👍, 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, 2467👍, 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, 2462👍, 0💬

What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy? The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
2012-11-15, 2461👍, 0💬

How do you restrict a user to cut and paste from the html page?
How do you restrict a user to cut and paste from the html page? Using Servlet or client side scripts to lock keyboard keys. It is one of solutions.
2012-08-10, 2461👍, 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, 2461👍, 0💬

How would you make a copy of an entire Java object with its state?
How would you make a copy of an entire Java object with its state? Have this class implement Cloneable interface and call its method clone().
2013-04-16, 2454👍, 0💬

Why are the interfaces more flexible than abstract classes?
Why are the interfaces more flexible than abstract classes? --An interface-defined type can be implemented by any class in a class hierarchy and can be extended by another interface. In contrast, an abstract-class-defined type can be implemented only by classes that subclass the abstract class. --An...
2013-03-06, 2454👍, 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, 2453👍, 0💬

What is the relationship between an event-listener interface and an event-adapter class?
What is the relationship between an event-listener interface and an event-adapter class? An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.
2012-12-03, 2447👍, 0💬

What is a Container in a GUI?
What is a Container in a GUI? A Container contains and arranges other components (including other containers) through the use of layout managers, which use specific layout policies to determine where components should go as a function of the size of the container.
2012-08-13, 2447👍, 0💬

In which case would you choose a static inner class?
In which case would you choose a static inner class? Interesting one, static inner classes can access the outer class's protected and private fields. This is both a positive and a negitive point for us since we can, in essence, violate the encapsulation of the outer class by mucking up the outer cla...
2012-09-07, 2440👍, 0💬

What is polymorphism?
What is polymorphism? Polymorphism means "having many forms". It allows methods (may be variables) to be written that needn't be concerned about the specifics of the objects they will be applied to. That is, the method can be specified at a higher level of abstraction and can be counted on to work e...
2012-08-14, 2440👍, 0💬

Can a double value be cast to a byte?
Can a double value be cast to a byte? Yes, a double value can be cast to a byte.
2012-10-25, 2439👍, 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, 2438👍, 0💬

How do you create a read-only collection?
How do you create a read-only collection? The Collections class has six methods to help out here: 1. unmodifiableCollection(Collect ionc) 2. unmodifiableList(List list) 3. unmodifiableMap(Map m) 4. unmodifiableSet(Set s) 5. unmodifiableSortedMap(SortedMa pm) 6. unmodifiableSortedSet(SortedSe ts) If ...
2012-08-30, 2436👍, 0💬

Does the code in finally block get executed if there is an exception and a return statement in a catch block?
Does the code in finally block get executed if there is an exception and a return statement in a catch block? If an exception occurs and there is a return statement in catch block, the finally block is still executed. The finally block will not be executed when the System.exit(1) statement is execut...
2012-08-10, 2436👍, 0💬

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