import java.util.*;
public class TestThread{
public static void main(String[] args){
//Runnable1 myThread = new Runnable1();
MyThread t = new MyThread();
t.start();
try{
t.sleep(10000);
}catch(InterruptedException e){}
t.interrupt();
}
}
class MyThread extends Thread {
public void run(){
while(true){
System.out.println("====" + new Date()+"====");
try{
sleep(1000);
}catch(InterruptedException e){
return;
}
}
}
}我是用jdk编译的
public class TestThread{
public static void main(String[] args){
//Runnable1 myThread = new Runnable1();
MyThread t = new MyThread();
t.start();
try{
t.sleep(10000);
}catch(InterruptedException e){}
t.interrupt();
}
}
class MyThread extends Thread {
public void run(){
while(true){
System.out.println("====" + new Date()+"====");
try{
sleep(1000);
}catch(InterruptedException e){
return;
}
}
}
}我是用jdk编译的
java.sql.Date是java.util.Date的子类。代码没问题
要是不行的话你直接import java.util.Date试试……
反正我试着没问题=。=
new java.util.Date();
java.util.Date没错
Date()为地球人所用,本星际使用Etad(),请修改代码重新编译.