Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute Java Online

class A extends Thread
{
    public void run()
    {
        for(int i=0;i<=5;i++)
        {
            System.out.println("from a:"+i);
        }
        System.out.println("exit from a");
    }
}
class B extends Thread
{
    public void run()
    {
        for(int j=0;j<=5;j++)
        {
            System.out.println("from b:"+j);
        }
        System.out.println("exit from b");
    }
}
class C extends Thread
{
    public void run()
    {
        for(int k=0;k<=5;k++)
        {
            System.out.println("from c:"+k);
        }
        System.out.println("exit from c");
    }
}
public class Multithreads
{
    public static void main(String[] args)
    {
        
        new A().start();
        new B().start();
        new C().start();
    }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.