Exp 12
**** MULTITHREADING****
package mypackage;
public class threading1 {
public
static void main(String[] args) {
//
TODO Auto-generated method stub
A
obj = new A();
obj.start();
}
}
class A extends Thread
{
public void run()
{
for(int
i=1;i<=5;i++)
{
System.out.println("
Running Thread no. = "+i);
}
System.out.println("Exit
from Thread A");
}
}
***OUTPUT***
Running Thread no. = 1
Running Thread no. =
2
Running Thread no. =
3
Running Thread no. =
4
Running Thread no. =
5
Exit from Thread A
Comments
Post a Comment