classpath是jkd1.5\jre\lib\rt.jar;.;
敲了个书上的程序进去
public class example
{
public static void main(String args[])
{
long x=5678;
float f=123.456789f;
double d=123456.12345678;
char c= 'a ';
System.out.printf( "%c\n%/10.3f%n%f,%12d%n%d,c,f,d,x=x+2,x ");
}
}
编译能够通过,但是不能运行,一运行就出现下面的错误!
各位大虾帮我看看
谢谢
Exception in thread "main " java.util.UnknownFormatConversionException: Conversio
n = '/ '
at java.util.Formatter.checkText(Formatter.java:2500)
at java.util.Formatter.parse(Formatter.java:2464)
at java.util.Formatter.format(Formatter.java:2411)
at java.io.PrintStream.format(PrintStream.java:899)
at java.io.PrintStream.printf(PrintStream.java:800)
at example.main(example.java:9)
Press any key to continue...
------解决方案--------------------
public class example
{
public static void main(String args[])
{
long x=5678;
float f=123.456789f;
double d=123456.12345678;
char c= 'a ';
System.out.printf( "%c\n%10.3f%n%f,%12d%n%d ",c,f,d,x=x+2,x);
}
}
简单修改了下,你原来的程序根本没有读取过你定义的变量
------解决方案--------------------
System.out.printf( "%c\n%/10.3f%n%f,%12d%n%d,c,f,d,x=x+2,x ");格式有问题呀.