日期:2014-05-20  浏览次数:20924 次

Java一个简单问题
大家帮忙看看那里出问题了?

public class SecondJavaForC
{
  public static void main(String[] agrs)
  {
  System.out.printf("s%! Java程序hi","c语言Fan").println();
  }  
}

运行结果:
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '!'
  at java.util.Formatter.checkText(Formatter.java:2500)
  at java.util.Formatter.parse(Formatter.java:2482)
  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 SecondJavaForC.main(SecondJavaForC.java:6)

------解决方案--------------------
字符格式有问题
s%
改改就好