Java: String format example 

Joined:
04/09/2007
Posts:
710

June 16, 2010 21:24:38    Last update: June 16, 2010 21:24:38
More arguments than format specifiers (place holders) are allowed but not vise versa.
public class TestStringFormat {
    public static void main(String[] args) {
	System.out.println(String.format("%s", "a", "b", "c"));
	System.out.println(String.format("%s%s", "a", "b", "c"));
	System.out.println(String.format("%s%s%s", "a", "b", "c"));
	System.out.println(String.format("%s%s%s%s", "a", "b", "c"));
    }
}
Share |
| Comment  | Tags
 
Easy email testing with http://www.ximailstop.com