The constructor Date() is undefined
来源:互联网 发布:linux下vi保存退出 编辑:程序博客网 时间:2024/06/04 18:04
import java.util.Date;// notification: don't import java.sql.Date.*;public class TestInterrupt {public static void main(String[] args) {Thread3 thread =new TestInterrupt().new Thread3();//** a instance must be The type of TestInterruptthread.start();try {Thread.sleep(10000);} catch(InterruptedException e ) {thread.interrupt();}}class Thread3 extends Thread {boolean flag = true;//end the thread boolean flag= falsepublic void run() {while(flag) {System.out.println("the latest time is:"+ new Date() +" good morning!"); try {sleep(1000);} catch(InterruptedException e) {return;}}}}}
原因:应该导入util包,而非sql;
Myelicpse.10有时会自动 import java.sql.Date;
故应改为 import java.util.Date;
即可成功运行程序。
阅读全文
0 0
- The constructor Date() is undefined
- The constructor Date() is undefined
- The constructor Date() is undefined问题的处理
- Android报错:The constructor Date() is undefined
- The constructor AlertDialog.Builder(***) is undefined
- android异常:The constructor Data() is undefined
- The constructor XMLOutputter(Format) is undefined
- The constructor FirefoxDriver(FirefoxBinary, FirefoxProfile) is undefined
- The constructor AnimatorSet.Builder(xxx) is undefined错误类型
- The constructor Intent(new View.OnClickListener(){}, Class<ButtonStudyActivity>) is undefined
- 提示错误:The constructor FileInputStream(File) is undefined
- 兔子--The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined
- The constructor Service(URL, QName, WebServiceFeature[]) is undefined
- The constructor Intent(new View.OnClickListener(){}, Class<ButtonStudyActivity>) is undefined
- the constructor AlertDialog.Builder(new View.OnClickListener() ) is undefined
- 报错The constructor worker(int, String, float) is undefined
- The constructor Intent(new View.OnClickListener(){}, Class<ButtonStudyActivity>) is undefined
- The constructor UrlEncodedFormEntity(List<NameValuePair>, String) is undefined
- 关于敏捷开发的总结
- IT人生存法则
- 如何编写高效的代码心得
- spring中利用aspectJ自定义注解
- 详解5种跨域方式及其原理
- The constructor Date() is undefined
- MacOs安装Android Studio3.0的一些坑点
- 考研英语
- 三论微积分下放中学
- WinForm基础控件--文本控件
- tmux多个session使用不同配置
- SpaceX 第 13 次成功回收猎鹰 9 号火箭
- 顺丰迎来三大强援,无人机商业化进程加速
- 科技行业巨额薪资抢夺AI人才,初创企业难敌巨头