Java FAQ's
Java Faq's
1. Abstract classes may have some executable methods and methods left
unimplemented. Interfaces contain no implementation code.
2. An class can implement any number of interfaces, but subclass at most one abstract class.
3. An abstract class can have nonabstract methods. All methods of an interface are
abstract.
4. An abstract class can have instance variables. An interface cannot.
5. An abstract class can define constructor. An interface cannot.
6. An abstract class can have any visibility: public, protected, private or none
(package). An interface's visibility must be public or none (package).
7. An abstract class inherits from Object and includes methods such as clone() and
equals().
User-defined exceptions may be implemented by
1 defining a class to respond to the exception and
2 embedding a throw statement in the try block where the exception can occur or
declaring that the method throws the exception (to another method where it is
handled).
The developer can define a new exception by deriving it from the Exception class as follows:
public class MyException extends Exception {
/* class definition of constructors (but NOT the exception handling code) goes here public MyException() {
super();
}
public MyException( String errorMessage ) {
super( errorMessage );
}
}
The throw statement is used to signal the occurance of the exception within a try block. Often, exceptions are instantiated in the same statement in which they are thrown using the
syntax.
throw new MyException("I threw my own exception.")
To handle the exception within the method where it is thrown, a catch statement that handles MyException, must follow the try block. If the developer does not want to handle the exception in the method itself, the method must pass the exception using the syntax:
public myMethodName() throws MyException
JavaARchive files are a big glob of Java classes, images, audio, etc., compressed to make
one simple, smaller file to ease Applet downloading. Normally when a browser encounters
an applet, it goes and downloads all the files, images, audio, used by the Applet separately.
This can lead to slower downloads.
Quite simply, object serialization provides a program the ability to read or write a whole object to and from a raw byte stream. It allows Java objects and primitives to be encoded into a byte stream suitable for streaming to some type of network or to a file-system, or more generally, to a transmission medium or storage facility. A seralizable object must implement the Serilizable interface. We use ObjectOutputStream to write this object to a stream and ObjectInputStream to read it from the stream.
Null interfaces act as markers..they just tell the compiler that the objects of this class need to be treated differently..some marker interfaces are : Serializable, Remote, Cloneable

It's a modifier. Synchronized methods are methods that are used to control access to 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 synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.

Singleton is a design pattern meant to provide one and only one instance of an object. Other objects can get a reference to this instance through a static method (class constructor is kept private). Why do we need one? Sometimes it is necessary, and often sufficient, to create a single instance of a given class. This has advantages in memory management, and for Java, in garbage collection. Moreover, restricting the number of instances may be necessary or desirable for technological or business reasons--for example, we may only want a single instance of a pool of database connections.

The smallest unit of source code that can be compiled, i.e. a .java file.

String is a class, but not a wrapper class. Wrapper classes like (Integer) exist for each primitive type. They can be used to convert a primitive data value into an object, and viceversa.
In its simplest form, a resource bundle is represented by a text file containing keys and a text value for each key.