please help me to remove the error coming with thy and catch statement in 8 and 17 line
import java.io.*;
class UserThread extends Thread
{
static int a[]=new int[10];
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("User thread started");
for(int i=0;i<10;i++)
{
System.out.println("Enter "+(i+1)+" value");
a[i]=Integer.parseInt(br.readLine());
}
}
catch(InterruptedException e)
{
System.out.println("Tread is about to interrupt");
}
}
class InterruptTest
{
public static void main(String s[])
{
UserThread th=new UserThread();
th.start();
System.out.println("main thread is about to sleep");
try
{
sleep(20000);
}
catch(Exception e)
{
e.printStackTrace();
}
th.interrupt();
int sum=0;
for(int i=0;i<10;i++)
{
sum+=UserThread.a[i];
}
System.out.println("Sum= "+sum);
}
}