-2

Thread Program

This program is showing a error marked in the image as red underline. I cant understand that why it occurred. Can anyone suggest me anything?

2 Answers2

0

try to make the MyThread class static

static class MyThread ...

tanyehzheng
  • 2,201
  • 1
  • 20
  • 33
0

You are getting a compilation error because you are referring to a non-static member from static context.

add static before the class declaration

static class MyThread extends Thread

A G
  • 297
  • 1
  • 7