Why this does work OK?:
String f = "Mi name is %s %s.";
System.out.println(String.format(f, "John", "Connor"));
And this doesnt?:
String f = "Mi name is %s %s.";
System.out.println(String.format(f, (Object)new String[]{"John","Connor"}));
If the method String.format takes a vararg Object?
It compiles OK but when I execute this the String.format() takes the vararg Object as a single an unique argument (the toString() value of the array itself), so it throws a MissingFormatArgumentException because it cannot match with the second string specifier (%s).
How can I make it work? Thanks in advance, any help will be greatly appreciated.