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

What are three ways in which a thread can enter the waiting state?
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...
2012-06-04, 2342👍, 0💬

What are 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...
2012-06-04, 2294👍, 0💬

What is synchronization and why is it important?
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...
2012-05-31, 2281👍, 0💬

How are Observer and Observable used?
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...
2012-05-31, 2444👍, 0💬

Which containers use a border layout as their default layout?
Which containers use a border layout as their default layout? The Window, Frame and Dialog classes use a border layout as their default layout.
2012-05-30, 2601👍, 0💬

What is a transient variable?
What is a transient variable? A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static.
2012-05-30, 2395👍, 0💬

What is the difference between Serializalble and Externalizable interface?
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...
2012-05-29, 2379👍, 0💬

How many methods in the Externalizable interface?
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 writeExternal().
2012-05-29, 2473👍, 0💬

How many methods in the 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.
2012-05-28, 2368👍, 0💬

If a class is located in a package, what do you need to change in the OS environment to be able to use it?
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 a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located...
2012-05-28, 2292👍, 0💬

How to define an Interface?
How to define an Interface? In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface. Emaple of Interface: public interface sampleInterface { public void funct...
2012-05-24, 2231👍, 0💬

How to define an Abstract class?
How to define an Abstract class? A class containing abstract method is called Abstract class. An Abstract class can't be instantiated. Example of Abstract class: abstract class testAbstractClass { protected String myString; public String getMyString() { return myString; } public abstract string anyA...
2012-05-24, 2343👍, 0💬

What is similarities/difference between an Abstract class and Interface?
What is similarities/difference between an Abstract class and Interface? Differences are as follows: Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a ...
2012-05-23, 2377👍, 0💬

Is Iterator a Class or Interface? What is its use?
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.
2012-05-23, 2315👍, 0💬

What do you understand by 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...
2012-05-22, 2246👍, 0💬

Name the containers which uses Border Layout as their default layout?
Name the containers which uses Border Layout as their default layout? Containers which uses Border Layout as their default are: window, Frame and Dialog classes.
2012-05-21, 2251👍, 0💬

What's the difference between an interface and an abstract class?
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...
2012-05-21, 2208👍, 0💬

How could Java classes direct program messages to the system console, but error messages, say to a file?
How could Java classes direct program messages to the system console, but error messages, say to a file? The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This ho...
2012-05-18, 2237👍, 0💬

An application needs to load a library before it starts to run, how to code??
An application needs to load a library before it starts to run, how to code?? One option is to use a static block to load a library before anything is called. For example, class Test { static { System.loadLibrary("path-to-li brary-file");} .... } When you call new Test(), the static block will be ca...
2012-05-18, 2386👍, 0💬

What is NullPointerException and how to handle it?
What is NullPointerException and how to handle it? When an object is not initialized, the default value is null. When the following things happen, the NullPointerException is thrown: --Calling the instance method of a null object. --Accessing or modifying the field of a null object. --Taking the len...
2012-05-17, 2359👍, 0💬

What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class? Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you c...
2012-05-17, 2421👍, 0💬

Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a change to the map. He decided to make a clone of the map in order to save the original data on side. What do you think of it? ? If Jack made a clone of the map, any changes to the clone or the original map...
2012-05-16, 2374👍, 0💬

Can you have 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...
2012-05-16, 2418👍, 0💬

What does a well-written OO program look like?
What does a well-written OO program look like? A well-written OO program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.
2012-05-15, 2462👍, 0💬

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