I want to print number in the below format. This should be taken care by two thread t1,t2. Can anyone help to enhance the below code which I have written?
First t1 should print 0-4
Then t2 should print 5-9
Then again t1 should print 10-14
Then t2 should print 15-19
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
class PrintNumber implements Runnable{
    String name;
    public void run(){
            print();
    }
    synchronized public void print(){
            for(int i=0;i< 5;i++){
                System.out.println(i+" -- "+Thread.currentThread());
            }
    }
    public static void main(String[] args){
        Runnable r = new PrintNumber();
        Thread t1 = new Thread(r,"t1");
        Thread t2 = new Thread(r,"t2");
        t1.start();
        t2.start();
    }
}
 
     
    