Breaking News

throw Keyword in java

the throw keyword is used to throw an exception explicitly. The only object of the Throwable class or its sub classes can be thrown. Program execution stops on encountering throw statement, and the closest catch …

Read More »

User defined Exception subclass

You can also create your own exception sub class simply by extending java Exception class. You can define a constructor for your Exception sub class (not compulsory) and you can override the toString() function to …

Read More »

Method Overriding with Exception Handling

There are few things to remember when overriding a method with exception handling. If super class method does not declare any exception, then sub class overriden method cannot declare checked exception but it can declare …

Read More »

Chained Exception

Chained Exception was added to Java in JDK 1.4. This feature allow you to relate one exception with another exception, i.e one exception describes cause of another exception. For example, consider a situation in which …

Read More »

Exception Handling

Chained Exception was added to Java in JDK 1.4. This feature allow you to relate one exception with another exception, i.e one exception describes cause of another exception. For example, consider a situation in which …

Read More »

What is Multithreading in java?

What is Multithreading in java? Multithreading A program can be divided into a number of small processes. Each small process can be addressed as a single thread (a lightweight process). Multithreaded programs contain two or …

Read More »

Thread Class in java

Thread class is the main class on which Java’s Multithreading system is based. Thread class, along with its companion interface Runnable will be used to create and run threads for utilizing Multithreading feature of Java. …

Read More »

Creating a thread in java

Java defines two ways by which a thread can be created. By implementing the Runnable interface. By extending the Thread class. Implementing the Runnable Interface The easiest way to create a thread is to create …

Read More »

Joining threads in java

Sometimes one thread needs to know when another thread is ending. In java, isAlive() and join() are two different methods to check whether a thread has finished its execution. The isAlive() method returns true if …

Read More »

Synchronization in java

At times when more than one thread try to access a shared resource, we need to ensure that resource will be used by only one thread at a time. The process by which this is …

Read More »

Interthread Communication in java

Java provide benefit of avoiding thread pooling using interthread communication. The wait(), notify(),notifyAll() of Object class. These method are implemented as final in Object. All three method can be called only from within a synchronized …

Read More »

Enumerations in java

Enumerations was added to Java language in JDK5. Enumeration means a list of named constant. In Java, enumeration defines a class type. An Enumeration can have constructors, methods and instance variables. It is created using …

Read More »

Autoboxing and Unboxing In Java

Autoboxing and Unboxing Autoboxing and Unboxing features was added in Java5. Autoboxing is a process by which primitive type is automatically encapsulated(boxed) into its equivalent type wrapper Auto-Unboxing is a process by which the value …

Read More »

IO Stream

Java performs I/O through Streams. A Stream is linked to a physical layer by java I/O system to make input and output operation in java. In general, a stream means continuous flow of data. Streams …

Read More »