File and Input Output in Java

In Java programming, to perform the input-output in file handling  Java has a java.io package which contain contains nearly every class you might ever need. In file handling streams represent an input source and an output destination. Stream In java programming, a sequence of data defined as a “stream”. Simply  there are two type of … Read more

Thread Synchronization in Java

When two or more threads try to access the same resource, they need somehow to ensure that the resource will be used by only one thread at a time. The process by which this achive is called Synchronization. Java uses the concept of monitor (also called semaphore) for Synchronization. The monitor allows one thread at … Read more

Thread Priorities in Java

In java, when two or more than  two thread is computing for CPU time, every thread is assigned a priority value. A highest Priority thread get preference over lower priority thread.   All Java threads have a priority in the range 1-10. Top priority is 10, lowest priority is 1.Normal priority ie. priority by default … Read more

Main Thread in Java

In Java programming, when a program begins the first thread that starts running is called main thread.  Other threads(child thread) can be spawned from this main thread. When program terminates, the main thread must be the last thread in the program to end. When the main thread stops, the program stops running. Main thread is … Read more

Finally Keyword in Java

In java exception handling, any code that we want to must be execute put inside the finally block. After the execution of try and catch block, finally block executes. try block must be used with either catch or finally, or with both. Normally when exception occurs then further programs never executes.  But either exception occurs … Read more