public class Demo {
public static void main(String args[])
{
double d = 12.345;
System.out.printf("|%7.3f|\n",d);
}
}
出力が| 12.345 |OCJP - javaでprintfを実装する
7.3fは何を示していますか?printfで使用できる他のオプションも知っています。 私が使用する場合
System.out.printf("|%5.3f|\n",d);
私は同じ出力を得るのですか?なぜですか?
http://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm – Kent