Java -The method sleep(int) is undefined for the type Thread

后端 未结 7 2044
南方客
南方客 2020-12-18 14:46

I\'m getting an error: The method sleep(int) is undefined for the type Thread. I thought the sleep method is in the Thread class in Java.

import java.util.Ra         


        
相关标签:
7条回答
  • 2020-12-18 15:41

    The problem is that your class is named Thread, which doesn't have a sleep() method. The sleep method is in java.lana.Thread, which is being hidden by your class.

    0 讨论(0)
提交回复
热议问题