what does the % % mean in java?

我只是一个虾纸丫 提交于 2019-12-05 23:32:19

PHP has a similar function: http://php.net/printf The Documentation of the Java version can be found here: http://java.sun.com/javase/6/docs/api/java/util/Formatter.html

The % character is a format specifier which controls how the corresponding variables are formatted.

In this particular case, the two argumnents x and Math.exp(x) are formatted as floats with three fractional digits.

You should of course already know this, even as a PHP coder, since PHP itself appears to have printf and the format specifiers are listed here.

%.3f means the same thing in Java as in C/C++. It means a floating point number with three digits after the decimal point.

This is standard printf formatting. The % stands for 'put an argument here', and the various dots, numbers and letters after the % specify the type of argument.

and, to be complete, the %n represents the platform specific line separator in the printf...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!