Showing posts with label Multi-threading. Show all posts
Showing posts with label Multi-threading. Show all posts

Monday, 7 September 2015

Multithreading in JAVA using Runnable Interface

                       After learning How to perform Multithreading in Java, the next step is to learn the same by using Runnable Interface. As explained in earlier post (Multithreading in Java) a class needs to extend Thread Class to achieve Multithreading. But when we want to do the same by using Runnable Interface, we must understand that Runnable is a interface not a class.

Multithreading in JAVA

                     JAVA is a very powerful language which supports many features. Multi-threading & Graphics programming are only few of them. Today, I am going to discuss a very simple program to explain both these concepts. Also I will share code with you on this post as well as on my GitHub account. Lets start the discussion with Multi-threading. Multi-treading allows programmer to use computer's resources in a very efficient manner. A Multi-threaded program is one which contains 2 or more parts that can run concurrently. Each part of such program is called a Thread & it defined the separate path for execution. Now a days all modern Operating Systems supports Multitasking. Multi-tasking is basically divided into two types: Process Based &  Thread Based.