result:"      mama"
System.out.println("\""+String.format("%10s", "mama")+"\"");
result:"mama      "
System.out.println("\""+String.format("%-10s", "mama")+"\"");
result:"3.1415927"
System.out.println("\""+String.format("%2.7f", Math.PI)+"\"");
No comments:
Post a Comment