Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  




Share on Google+Share on Google+

3 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners


View Answers

September 13, 2012 at 4:19 PM


An interface is one which has abstract methods(not defined just declared)and static or non static variables.Any class can implement(inherit)the interface and make use of the methods(functions) and variables within it.
* A class inherits only constants from an interface.
* A class cannot inherit method implementations from an interface.
* The interface hierarchy is independent of the class hierarchy.
* Capturing similarities between unrelated classes without artificially forcing a class relationship.
* Declaring methods that one or more classes are expected to implement.
* Revealing an object's programming interface without revealing its class.

In java, multiple inheritance is achieved by using the interface (by implementing more than one interface at a time)

Example of Interface:

interface Ex{

int getData();

void setData(int x);

class InterfaceExample implements Ex 
    int x;
    public int getData(){
        return x;
    public void setData(int x){
    public static void main(String[] args) 
    InterfaceExample ex=new InterfaceExample();
    int num=ex.getData();

For more information, visit the following link:

September 13, 2012 at 5:01 PM


Exception are such anomalous conditions (or typically an event) which changes the normal flow of execution of a program. Exceptions are used for signaling erroneous (exceptional) conditions which occur during the run time processing. Exceptions may occur in any programming language.

Occurrence of any kind of exception in java applications may result in an abrupt termination of the JVM or simply the JVM crashes which leaves the user unaware of the causes of such anomalous conditions. However Java provides mechanisms to handle such situations through its superb exception handling mechanism. The Java programming language uses Exception classes to handle such erroneous conditions and exceptional events.

For more information, visit the following link:

Exception Handling in Java

September 13, 2012 at 5:13 PM


A thread is a lightweight process which exist within a program and executed to perform a special task. Several threads of execution may be associated with a single process. Thus a process that has only one thread is referred to as a single-threaded process, while a process with multiple threads is referred to as a multi-threaded process.

In Java Programming language, thread is a sequential path of code execution within a program. Each thread has its own local variables, program counter and lifetime. In single threaded runtime environment, operations are executes sequentially i.e. next operation can execute only when the previous one is complete. It exists in a common memory space and can share both data and code of a program. Threading concept is very important in Java through which we can increase the speed of any application. You can see diagram shown below in which a thread is executed along with its several operations with in a single process.

For more information, visit the following link:

Thread Tutorials


Related Tutorials/Questions & Answers:
interfaces,exceptions,threads  SIR,IAM JAVA BEGINER,I WANT KNOW THE COMPLETE CONEPTS OF INTERFACES,EXCEPTIONS,THREADS   Interface.../interface.shtml   Exceptions Exception are such anomalous conditions