public class InterfaceExample implements Runnable {
public void run()
{
System.out.println(" run method running");
}
public void first()
{
for(int i=0;i<=5;i++)
{
try{
Thread.sleep(100);
System.out.println(i);
}
catch(Exception e)
{
}
}
}
public void second()
{
for(int i=6;i<=10;i++)
{
try{
Thread.sleep(500);
System.out.println(i);
}
catch(Exception e)
{
}
}
}
public static void main(String[] args) {
InterfaceExample ie =new InterfaceExample();
Thread td=new Thread(ie);
td.start();
ie.first();
ie.second();
}
}
public void run()
{
System.out.println(" run method running");
}
public void first()
{
for(int i=0;i<=5;i++)
{
try{
Thread.sleep(100);
System.out.println(i);
}
catch(Exception e)
{
}
}
}
public void second()
{
for(int i=6;i<=10;i++)
{
try{
Thread.sleep(500);
System.out.println(i);
}
catch(Exception e)
{
}
}
}
public static void main(String[] args) {
InterfaceExample ie =new InterfaceExample();
Thread td=new Thread(ie);
td.start();
ie.first();
ie.second();
}
}