Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Java Thread and Runnable
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


samar
Java Thread and Runnable
1 Answer(s)      4 years ago
Posted in : Java Interview Questions


What's the difference between Thread and Runnable types?

Advertisement
View Answers

October 27, 2010 at 6:12 PM


Hi,

Here is the answer,

A Java Thread controls the main path of execution in an application. When you invoke the Java Virtual Machine with the java command, it creates an implicit thread in which to execute the main() method. The Thread class provides a mechanism for the first thread to start-up other threads to run in parallel with it.

The Runnable interface defines a type of class that can be run by a thread. The only method it requires is run(), which makes the interface very easy to fulfil by extending existing classes. A runnable class may have custom constructors and any number of other methods for configuration and manipulation.

Thanks.



Related Tutorials/Questions & Answers:
Java Thread and Runnable
Java Thread and Runnable  What's the difference between Thread and Runnable types
Java : Runnable Thread
Java : Runnable Thread In this tutorial we are describing Runnable Thread with example. Runnable Thread : Runnable thread is an easy way to create a thread by implementing the Runnable interface. You need to implement a single
Advertisements
implements runnable n extends thread - Java Beginners
implements runnable n extends thread  what is the difference between implements runnable n extends thread? public class...(); class StringThreadImplement implements Runnable { private String } }  Hi public class
Runnable interface in java
In this section we will learn about Runnable interface in java. In java thread are created by two ways, one by extending Thread class and another one by implementing Runnable interface
Difference between extends thread class vs implements runnable interface - Java Interview Questions
Difference between extends thread class vs implements runnable interface  Hi Friends, can you give difference between extending thread class... Runnable Interface, you can run the class several times whereas Thread have
Diff between Runnable Interface and Thread class while using threads
Diff between Runnable Interface and Thread class while using threads  Diff between Runnable Interface and Thread class while using threads   Hi Friend, Difference: 1)If you want to extend the Thread class
Diff between Runnable Interface and Thread class while using threads
Diff between Runnable Interface and Thread class while using threads  Diff between Runnable Interface and Thread class while using threads   Hi Friend, Difference: 1)If you want to extend the Thread class
Threads on runnable interface - Java Beginners
://www.roseindia.net/java/thread/thread-creation.shtml...Threads on runnable interface  need a program.....please reply asap Create 2 threads using runnable interface.First threads shd print "hello
Threads on runnable interface - Java Beginners
Threads on runnable interface  need a program.....please reply asap Create 2 threads using runnable interface.First threads shd print "hello....  Hi manshi, i am sending simple code of thread. class MyThread
runnable - Java Beginners
runnable  is java.lang.Runnable is marker interface?  Hi Friend, We all know that marker interface does not contain any method. But Runnable is a marker interface even though it is having run() method. Thanks
To make java exe or runnable file
To make java exe or runnable file   Helo sir i make a java application.I need to help how run application direct in pc i.e how it packaged, .exe file or setup file
Java Runnable Interface
Java Runnable Thread is a piece of the program execution. Java Runnable is an interface. Thread class implements it. Java has multithreading facility. Thread is also created by implementing the Runnable interface. Java
java Thread
java Thread  what is purpose of Thread
Java thread
Java thread  How can a dead thread be restarted?  A dead thread cannot be restarted
Java thread
Java thread  What's the difference between a thread's start() and run() methods
Java thread
Java thread  What are the high-level thread states
Java thread
Java thread  What are the ways in which you can instantiate a thread
Java thread
Java thread  What invokes a thread's run() method
Java thread
Java thread  What is the difference between process and thread
Thread
Thread  Explain two ways of creating thread in java. Explain at three methods of thread class.   Java Create Thread There are two main... is to implement the Runnable interface. Please Visit Here   Java
Java Thread
Java Thread In this tutorial we will discuss about Java Thread. Java Thread : A thread is light weight java program.JVM permits you to have multiple... the thread. Runnable : when you call start() it enter into the runnable
Java thread
Java thread  Why do threads block on I/O?   When a thread... and in that time some other thread which is not waiting for that IO gets a chance to execute.If any input is not available to the thread which got suspended for IO
Thread in java
Thread in java  which method will defined in thread class
Thread
. At this point, the thread is considered not alive. Runnable (Ready-to-run) state ? A thread start its life from Runnable state. A thread first enters runnable state... in Running state: the scheduler select a thread from runnable pool. Dead state
Java :Thread getPriority Example
Java :Thread getPriority Example In this tutorial you will learn how to get thread priority in java thread. Thread getPriority() : Thread scheduler uses... the priority of your thread. Example : class ThreadGetPriority implements Runnable
Java Thread : getState() Example
Java Thread : getState() Example This section explains how to get state of a thread  in java Thread. Thread  getState() : Suppose you want to know the state of the thread so for that Java Thread provides Thread.getState
Java :Thread setPriority Example
Java :Thread setPriority Example In this tutorial you will learn how to set thread priority in java thread. Thread setPriority() : Thread scheduler uses... to the current thread. class ThreadSetPriority implements Runnable { Thread
Java Thread class
It is created by extending the Thread class or implementing Runnable interface Java Thread Class Example public class thread1 extends Thread { @Override... Java Thread Class is a piece of the program execution Java has
JAVA THREAD - Java Beginners
JAVA THREAD  hii i wrote a pgm to print the numbers from 0 to 9 in 2...: class kj implements Runnable { public static void main(String ar[])throws...); } public void fgh(int i,int p) { int sum; new Thread(public void run
Java Thread
Java Thread       A java... sequential flow of control within a program. Programmer may use java thread mechanism...:/www.roseindia.net/java/thread/index.shtml
Thread
Thread  Write a Java program to create three theads. Each thread....   Java Thread Example class ThreadExample{ static int...) { } } }; Thread thread1 = new Thread(readRun1); thread1.start(); Runnable
Advertisements
 

 

 

DMCA.com