| Return | Method | Summary |
|---|---|---|
| static String | format(Locale l, String format, Object... args) | Returns a formatted string using the specified locale, format string, and arguments. |
| static String | format(String format, Object... args) | Returns a formatted string using the specified format string and arguments. |
public class Main {
public static void main(String[] argv) {
System.out.println(String.format("%4d", 0));
System.out.println(String.format("%4d", 11));
System.out.println(String.format("%4d", 222));
System.out.println(String.format("%4d", 3333));
}
}
The output:
0
11
222
3333java2s.com | | Contact Us | Privacy Policy |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |