filmov
tv
Display Two Column Table Num | Num^2 Using printf | Java

Показать описание
To display a simple two column table, you can use as following "
there is a lot of the format specifiers you can use in printf, if you need to know all format specifiers just google it,
here i will mention to integer & String format specifiers only :
%nd , n is any integer number , display any number in At least n space wide
e.g:
*number (10) will display in At least 3 space wide
*output will be right-justified, if you need left-justified output, type "-" after "%" ,(%-3d)
%ns , n is any integer number, display any String in At least n space wide
e.g:
*String "Java" will display in At least 6 space wide
*output will be right-justified, if you need left-justified output, type "-" after "%" (%-6s)
* you can type special characters that have a special meaning when used as format specifiers
like : \n newline, \t tab space, \b backspace
there is a lot of the format specifiers you can use in printf, if you need to know all format specifiers just google it,
here i will mention to integer & String format specifiers only :
%nd , n is any integer number , display any number in At least n space wide
e.g:
*number (10) will display in At least 3 space wide
*output will be right-justified, if you need left-justified output, type "-" after "%" ,(%-3d)
%ns , n is any integer number, display any String in At least n space wide
e.g:
*String "Java" will display in At least 6 space wide
*output will be right-justified, if you need left-justified output, type "-" after "%" (%-6s)
* you can type special characters that have a special meaning when used as format specifiers
like : \n newline, \t tab space, \b backspace