Multithreading in java watch online session on youtube in Hindi)
How to create thread in javawatch online session on youtube in Hindi)
What is runtime stack in Java?watch online session on youtube in English)
Sleep Method in Java ?watch online session on youtube in English)
What is Java Lock? Or Synchronizationwatch online session on youtube in English)
What is Thread Group in Java?watch online session on youtube in English)
Define Thread by extending Thread class
class myThread extends Thread
{
public void run()
{
for(int i=1; i<=10; i++)
{
System.out.println("Child thread is
running ");
}
}
}
class ThreadExtend
{
public static void main(String args[]) throws InterruptedException
{
myThread t = new myThread();
t.start();
for(int i=1; i<=10;i++)
{
System.out.println("Main thread ");
}
}
}
class myThread extends Thread
{
public void run()
{
for(int i=1; i<=10; i++)
{
System.out.println("Child thread is
running ");
}
}
}
class ThreadExtend
{
public static void main(String args[]) throws InterruptedException
{
myThread t = new myThread();
t.start();
for(int i=1; i<=10;i++)
{
System.out.println("Main thread ");
}
}
}