Skip to content
Advertisement

Getting error in Eclipse: syntax error on token start identifier expected

I am getting a strange error while creating a simple thread program in JAVA using Eclipse. The code is:

package threadshow;

public class Thread_Show extends Thread{

public void run(){
    System.out.println("Inside the thread");
}
 }

 class Thread_Definition{
Thread_Show ts=new Thread_Show();
ts.start();  //Getting the error here
}

I am getting error “syntax error on token start identifier expected” in the line ts.start();. Why am I getting this?

EDIT I have used the code from http://tutorials.jenkov.com/java-concurrency/creating-and-starting-threads.html#thread-subclass

Advertisement

Answer

Found a very bad mistake done my me. Forgot to add public static void main(String args[]) in the Thread_Definition class.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement