Java Formatting Output with the printf Method using Format Sub-Specifiers - Easy Example - APPFICIAL

preview_player
Показать описание
You can format the way that output appears by using the printf() method. The first argument of the printf() method is called the format string. It specifies the format of the text to be printed and may contain placeholders called format specifiers which begin with a % sign. There are also format sub-specifiers to further format the value’s appearance. The common ones are %d for integers, %f for floating point numbers or double, %s for string, %c for char, %% to print out a percent sign and %n for newline character. These work for the printf() and format() methods.

Format Sub-Specifiers include width, .precision and flags for floating-point and strings, and width and flags for integers

The general format is %(flags) (width) (.precision) specifier

SUBSCRIBE!
Рекомендации по теме
Комментарии
Автор

Please SUBSCRIBE! More programming videos coming soon! ✌️

Appficial
Автор

After i do this formatting I receive problem when creating txt file and write the result in it, printf do not work!!! Help

ahmadfx