
import java.util.*;

public class HelpPrintf
{

    // ***** main method *****
    public static void main(String[] arguments)
    {
        System.out.printf("Hello printf");
        System.out.printf("\n");
        System.out.printf("\n");
        System.out.printf("Replacement codes   %%s  %%d  %%f  %%c  %%b  \n");
        System.out.printf("%%s String\n");
        System.out.printf("%%d int\n");
        System.out.printf("%%f double or float\n");
        System.out.printf("%%c char\n");
        System.out.printf("%%b boolean\n");
        System.out.printf("\n");

        System.out.printf("Printing Strings\n");
        System.out.printf("%%10s means print using 10 print positions right justified\n");
        System.out.printf("%%-10s means print using 10 print positions left justified\n");
        System.out.printf("We will print \"Hello\" using 10 character print positions followed by =====\n");
        System.out.printf("%%10s is    :%10s=====%n","Hello");
        System.out.printf("%%-10s      :%-10s=====\n","Hello");
        System.out.printf("%%-10.3s is :%-10.3s=====\n","Hello");
        System.out.printf("%%10.3 is   :%10.3s=====\n","Hello");
        System.out.printf("\n");

        System.out.printf("Printing int\n");
        System.out.printf("%%5d  :%5d=====\n",34);
        System.out.printf("%%-5d :%-5d=====\n",35);
        System.out.printf("\n");

        System.out.printf("Printing double 3.14159\n");
        // System.out.printf("%5f=====\n",34); error
        System.out.printf("%%8f    :%8f=====\n",3.14159);
        System.out.printf("%%-8f   :%-8f=====\n",3.14159);
        System.out.printf("%%8.3f  :%8.3f=====\n",3.14159);
        System.out.printf("%%-8.3f :%-8.3f=====\n",3.14159);
        System.out.printf("%%3.2f  :%3.2f=====\n",3.14159);
        System.out.printf("\n");
        System.out.printf("\n");

        System.out.printf("Printing boolean true and false\n");
        System.out.printf("%%8b  :%8b=====\n",true);
        System.out.printf("%%-8b :%-8b=====\n",false);
        System.out.printf("\n");

    }

} // end of class HelpPrintf


/*
Hello printf

Replacement codes   %s  %d  %f  %c  %b  
%s String
%d int
%f double or float
%c char
%b boolean

Printing Strings
%10s means print using 10 print positions right justified
%-10s means print using 10 print positions left justified
We will print "Hello" using 10 character print positions followed by =====
%10s is    :     Hello=====
%-10s      :Hello     =====
%-10.3s is :Hel       =====
%10.3 is   :       Hel=====

Printing int
%5d  :   34=====
%-5d :35   =====

Printing double 3.14159
%8f    :3.141590=====
%-8f   :3.141590=====
%8.3f  :   3.142=====
%-8.3f :3.142   =====
%3.2f  :3.14=====


Printing boolean true and false
%8b  :    true=====
%-8b :false   =====
*/
