Java中格式化输出

Java中格式化输出

public class Test {
    public static void main(String[] args) {
        Double d = 10.2356;
        System.out.printf("%2.2f \n",d);//10.24
        String str = "My name is LittleLawson";
        System.out.printf("%s",str);
    }
}

猜你喜欢

转载自blog.csdn.net/liu16659/article/details/80231809
今日推荐