照书上打的,不能运行
import java.util.Date;public class hello
{
public static void main(String[] args)
{
Date date=new Date();
String hour=String.format("%tH",date);
String minute=String.format("%tM", date);
String second=String.format("%tS",date);
System.out.println("现在是:"+hour+"时"+minute+"分"+second+"秒");
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
The method format(String, Object[]) in the type String is not applicable for the arguments (String, Date)
The method format(String, Object[]) in the type String is not applicable for the arguments (String, Date)
The method format(String, Object[]) in the type String is not applicable for the arguments (String, Date)
at hello.main(hello.java:10)