I have been trying to execute this code in VS Code
class test1 extends Thread
{
public void run()
{
for(int i=0;i<10;i++)
System.out.println("Task 1");
}
}
class task2 extends Thread
{
public void run()
{
for(int i=0;i<10;i++)
System.out.println("Task 2");
}
}
public class app
{
public static void main(final String[] args) throws InterruptedException {
final test1 t1 = new test1();
final task2 t2 = new task2();
t1.start();
t2.start();
}
}
but it shows an exception in main thread:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at app.main(test1.java:21)
(see screenshot)
I tried different IDEs(like BlueJ) and this code is working fine with them. So what exactly is the problem I am facing while executing it in VS Code?