import java.util.*;public class Simple
{ public static void main(String[] args)
{
System.out.printf("%tc", new Date());
}}错误提示
xception in thread "main" java.lang.Error: Unresolved compilation problem:
The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, Date) at Simple.main(Simple.java:15)为什么会出现错误呢?我上网查了 我又加上这个包java.util.*;这个包,
后来我发现了用 printf输出有发现一个问题 System.out.printf(String format,object[] agrs);
这样的类型,后来发现这样也是错的, System.out.printf("hello");
System.out.printf("After year %d,your balance is %,.2f%n",year,balance);
我发现问题出现在printf这个方法
麻烦帮我解答一下
{ public static void main(String[] args)
{
System.out.printf("%tc", new Date());
}}错误提示
xception in thread "main" java.lang.Error: Unresolved compilation problem:
The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, Date) at Simple.main(Simple.java:15)为什么会出现错误呢?我上网查了 我又加上这个包java.util.*;这个包,
后来我发现了用 printf输出有发现一个问题 System.out.printf(String format,object[] agrs);
这样的类型,后来发现这样也是错的, System.out.printf("hello");
System.out.printf("After year %d,your balance is %,.2f%n",year,balance);
我发现问题出现在printf这个方法
麻烦帮我解答一下
Object... args)
也就是说你传入的new Date()这个参数是不符合要求的,这里需要的是一个对象数组比如这样传: Integer[] b = new Integer[1];
b[0]=new Integer(2); System.out.printf("b的值为%d",b);
配置 变量的时候 javac Hello.java 这个可以成功的产生 Hello.class
但是当我输入 java Hello 结果在屏幕(命令窗口) 不是“ Hello World ”, 而是好多行(提示错误的)。这怎么办呢?
classpath .;C:\Program Files\Java\jdk1.6.0_10\lib;
path C:\Program Files\Java\jdk1.6.0_10\bin; %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs 麻烦告诉我哪里错了谢谢
就是我 输出 System.out.printf("fjahfja"); 也得到上面那样的错误。
我下午重新在官方下载jdk jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008
还是不行
我一直找人帮我解答 不行啊大哥。跪求解决方法
http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-jdk-6u26-downloads-439816.html下载这个
java_ee_sdk-6u3-jdk-windows.exe