Interrupt() in multithreading...

PHOTO EMBED

Mon Jan 22 2024 09:34:49 GMT+0000 (Coordinated Universal Time)

Saved by @E23CSEU1151 #java

class A extends Thread
{
    public void run()
    {
        try
        {
            for(int i=1;i<=5;i++)
            {
                System.out.println("okay boss");
                Thread.sleep(1000);
            }
        }
        catch(Exception m)
        {
            System.out.println("some eror");
        }
    }
}
class F 
{
    public static void main(String[] args)
    {
        A r= new A();

        r.start();
        r.interrupt();
    }
}
content_copyCOPY