Comment on Tutorial - A simple Thread sample in Java By Henry



Comment Added by : DeeNKHAN

Comment Added at : 2013-03-02 06:54:13

Comment on Tutorial : A simple Thread sample in Java By Henry
class Foo implements Runnable{

public void run() {
for(int i=0;i<3;i++)

System.out.println("Run by..."+Thread.currentThread().getName()+",i Is "+ i);
}
public void run(String name){

System.out.println("This is Second"+name);
}
}
public class TestingThread {

public static void main(String args [])
{
Foo f = new Foo();
Thread t = new Thread(f);
try {
System.out.println("Number Will be printt After 5 Second..");
for(int j=0;j<5;j++){
System.out.println("This is j..."+j);

t.sleep(5000);
}
}
catch(InterruptedException e) {
System.out.println("InterruptedException.."+ e);
e.printStackTrace();
}
}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. This Example program is very useful.
good w

View Tutorial          By: sathya at 2008-03-28 02:21:41

2. i get error like this :
The requested resou

View Tutorial          By: Vera Yunita at 2013-05-20 03:57:18

3. hai, i tried the abvoe code, m getting the follwin
View Tutorial          By: anith at 2011-03-13 06:02:31

4. how to execute all these five programms tell me st
View Tutorial          By: shweta at 2008-09-24 07:35:22

5. Hi. When i click on Install certificate. It tells
View Tutorial          By: jaris at 2011-10-18 11:00:41

6. it's emergency
plz explain delimiter in tok

View Tutorial          By: sajad at 2013-02-03 05:56:44

7. Does Wait() inside synchronized create a race cond
View Tutorial          By: Aviator168 at 2010-04-21 16:02:06

8. i am new to java plz give any sample and simple ja
View Tutorial          By: sham at 2012-03-20 02:30:20

9. Hi
I have been trying for the same thing f

View Tutorial          By: Zaid Kazi at 2012-01-30 15:43:46

10. thanks bro it worked for me ....keep it up.
View Tutorial          By: azhar at 2010-12-27 00:44:36