StringFormat for Java Boolean Operator

前端 未结 6 504
再見小時候
再見小時候 2020-12-29 17:54

I know its very simple question. but I would like to know the stringformat for boolean operator. For example, below shows the string formats for integer, string and float.

6条回答
  •  别那么骄傲
    2020-12-29 18:41

    You can try this

        float floatVar=1.0f;
        int intVar=1;
        String stringVar="hi";
        boolean boolVar=false;
        System.out.printf("The value of the float " +
                        "variable is %f, while " +
                        "the value of the " +
                        "boolean variable is %b, " +
                        "and the string is %s",
                floatVar, boolVar, stringVar);
    

    %b is you are looking at

提交回复
热议问题