Thursday 24 November 2016

Thread program with try catch in core java example

public class Ar {


    public static void main(String[] args)

    {


        new x();


        try

        {

            for (int i = 5; i > 0; i--)

            {

                System.out.print("main thread" + i);

                Thread.sleep(1000);


            }

        } catch (InterruptedException e)

        {

            System.out.print(e);

        }

    }


}

No comments:

Post a Comment