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

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

Swing BorderLayout and Contrainer Classes
Name the containers which uses Border Layout as their default layout? Swing container classes which uses BorderLayout as their default are: Window, Frame and Dialog classes.
2007-03-03, 5349👍, 0💬

Preemptive Scheduling
What is the difference between preemptive scheduling and time slicing? Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and the...
2007-03-03, 5338👍, 0💬

What is a JavaBean
What is a JavaBean? JavaBeans are reusable software components written in the Java programming language, designed to be manipulated visually by a software develpoment environment, like JBuilder or VisualAge for Java. They are similar to Microsoft’s ActiveX components, but designed to be platform-neu...
2007-11-12, 5321👍, 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, 5299👍, 0💬

Iterator Interface
Is Iterator a Class or Interface? What is its use? Iterator is an interface which is used to step through the elements of a Collection.
2007-03-03, 5297👍, 0💬

Defining Abstract Classes
How to define an Abstract class? Defining an abstract class is done using the keyword "abstract". Here is an example of abstract class: abstract class MyAbstract { protected String myString; public String getMyString() { return myString; } public abstract string getMyStringInYourWay(); }
2007-03-03, 5281👍, 0💬

What Is Synchronization
What do you understand by Synchronization? Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modif...
2007-03-03, 5253👍, 0💬

Modifiers on Inner Classes
What modifiers may be used with an inner class that is a member of an outer class? A inner class may be declared as public, protected, private, static, final, or abstract.
2007-03-03, 5233👍, 0💬

CLASSPATH Environment Variable
If a class is located in a package, what do you need to change in the OS environment to be able to use it? You need to add the directory or the jar file that contains the package to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the ...
2007-03-03, 5216👍, 0💬

Is Ajax just another name for XMLHttpRequest?
Is Ajax just another name for XMLHttpRequest? No. XMLHttpRequest is only part of the Ajax equation. XMLHttpRequest is the technical component that makes the asynchronous server communication possible; Ajax is our name for the overall approach described in the article, which relies not only on XMLHtt...
2009-06-23, 5064👍, 0💬

Protected Methods
If a method is declared as protected, where may the method be accessed? A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
2007-03-03, 5054👍, 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, 4983👍, 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, 4912👍, 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, 4909👍, 0💬

What class allows you to read objects directly from a stream?
What class allows you to read objects directly from a stream? The ObjectInputStream class supports the reading of objects from input streams.
2012-07-31, 4895👍, 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, 4852👍, 0💬

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

How many objects are created in the following piece of code?
How many objects are created in the following piece of code? MyClass c1, c2, c3; c1 = new MyClass (); c3 = new MyClass (); Only 2 objects are created, c1 and c3. The reference c2 is only declared and not initialized.
2013-07-01, 4802👍, 0💬

How do I test my AJAX code?
How do I test my AJAX code? There is a port of JUnit for client-side JavaScript called JsUnit
2009-06-23, 4336👍, 0💬

Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?
Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*? No you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of it's sub...
2013-05-14, 4311👍, 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-07-18, 3974👍, 0💬

What method is used to specify a container's layout?
What method is used to specify a container's layout? The setLayout() method is used to specify a container's layout.
2013-04-08, 3853👍, 0💬

General technical question
What is the difference between Java and C++? What is the advantage of each of them? Java does not support typedefs, defines, or a preprocessor. Without a preprocessor, there are no provisions for including header files. Since Java does not have a preprocessor there is no concept of #define macros or...
2011-06-28, 3610👍, 0💬

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