public class CloneTest
{
public static void main(String[] args)
{
Date d = new Date();
System.out.println(  d.toString() );

}
}上面代码,如果按 Ctrl + F11 运行就没问题。如果按F11,那调试窗口输出下面的东西
CloneTest [Java 应用程序]
本地主机 52205 处的 CloneTest
线程 [main](已暂挂(异常 FileNotFoundException))
FileInputStream.open(String) 行: 不可用 [本机方法]
FileInputStream.<init>(File) 行: 不可用
ZoneInfoFile$1.run() 行: 不可用
AccessController.doPrivileged(PrivilegedExceptionAction<T>) 行: 不可用 [本机方法]
ZoneInfoFile.readZoneInfoFile(String) 行: 不可用
ZoneInfoFile.createZoneInfo(String) 行: 不可用
ZoneInfoFile.getZoneInfo(String) 行: 不可用
ZoneInfo.getTimeZone(String) 行: 不可用
TimeZone.getTimeZone(String, boolean) 行: 不可用
TimeZone.setDefaultZone() 行: 不可用
TimeZone.getDefaultRef() 行: 不可用
Date.normalize() 行: 不可用
Date.toString() 行: 不可用
String.valueOf(Object) 行: 不可用
PrintStream.println(Object) 行: 不可用
CloneTest.main(String[]) 行: 11
D:\JDK\bin\javaw.exe(2012-7-26 下午02:49:47)
CloneTest [Java 应用程序]
本地主机 52216 处的 CloneTest
线程 [main](已暂挂(异常 FileNotFoundException))
FileInputStream.open(String) 行: 不可用 [本机方法]
FileInputStream.<init>(File) 行: 不可用
ZoneInfoFile$1.run() 行: 不可用
AccessController.doPrivileged(PrivilegedExceptionAction<T>) 行: 不可用 [本机方法]
ZoneInfoFile.readZoneInfoFile(String) 行: 不可用
ZoneInfoFile.createZoneInfo(String) 行: 不可用
ZoneInfoFile.getZoneInfo(String) 行: 不可用
ZoneInfo.getTimeZone(String) 行: 不可用
TimeZone.getTimeZone(String, boolean) 行: 不可用
TimeZone.setDefaultZone() 行: 不可用
TimeZone.getDefaultRef() 行: 不可用
Date.normalize() 行: 不可用
Date.toString() 行: 不可用
<旧方法,位于><未知声明类型>>
D:\JDK\bin\javaw.exe(2012-7-26 下午02:51:33)
CloneTest [Java 应用程序]
本地主机 52223 处的 CloneTest
线程 [main](已暂挂(异常 FileNotFoundException))
FileInputStream.open(String) 行: 不可用 [本机方法]
FileInputStream.<init>(File) 行: 不可用
ZoneInfoFile$1.run() 行: 不可用
AccessController.doPrivileged(PrivilegedExceptionAction<T>) 行: 不可用 [本机方法]
ZoneInfoFile.readZoneInfoFile(String) 行: 不可用
ZoneInfoFile.createZoneInfo(String) 行: 不可用
ZoneInfoFile.getZoneInfo(String) 行: 不可用
ZoneInfo.getTimeZone(String) 行: 不可用
TimeZone.getTimeZone(String, boolean) 行: 不可用
TimeZone.setDefaultZone() 行: 不可用
TimeZone.getDefaultRef() 行: 不可用
Date.normalize() 行: 不可用
Date.toString() 行: 不可用
CloneTest.main(String[]) 行: 11
D:\JDK\bin\javaw.exe(2012-7-26 下午02:52:45)
CloneTest [Java 应用程序]
本地主机 52344 处的 CloneTest
线程 [main](已暂挂(异常 FileNotFoundException))
FileInputStream.open(String) 行: 不可用 [本机方法]
FileInputStream.<init>(File) 行: 不可用
ZoneInfoFile$1.run() 行: 不可用
AccessController.doPrivileged(PrivilegedExceptionAction<T>) 行: 不可用 [本机方法]
ZoneInfoFile.readZoneInfoFile(String) 行: 不可用
ZoneInfoFile.createZoneInfo(String) 行: 不可用
ZoneInfoFile.getZoneInfo(String) 行: 不可用
ZoneInfo.getTimeZone(String) 行: 不可用
TimeZone.getTimeZone(String, boolean) 行: 不可用
TimeZone.setDefaultZone() 行: 不可用
TimeZone.getDefaultRef() 行: 不可用
Date.normalize() 行: 不可用
Date.toString() 行: 不可用
CloneTest.main(String[]) 行: 11
D:\JDK\bin\javaw.exe(2012-7-26 下午02:57:42)

解决方案 »

  1.   

    编译是通不过的啊。
    我机器只有jdk 所以我编译了下你写的 根本就编译不过去。
      

  2.   

    刚才忘了引包了 哈哈 Date date = new Date(); 
      DateFormat df = new SimpleDateFormat("yyyy-yy-yy"); 
      String birthday = df.format(date);
      

  3.   

    package a;import java.util.Date;public class CloneTest
    {
        public static void main(String[] args)
        {
            Date d = new Date();
            System.out.println(  d.toString() );//System.out.println(  d );//一样效果
            
        }
    }
    结果:
    Thu Jul 26 15:24:33 CST 2012
      

  4.   

    public class CloneTest { public static void main(String[] args) { java.util.Date d = new java.util.Date(); System.out.println( d.toString() );//System.out.println( d );//一样效果 } }
      

  5.   

    正解, 好像就是少了import java.util.Date;
      

  6.   

    悲催的楼主是eclipse的问题。
    你还是用myeclipse吧。