Fork of the Fernflower decompiler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fernflower/testData/src/pkg/TestVarArgCalls.java

29 lines
841 B

package pkg;
public class TestVarArgCalls {
public void doSmth() {
printAll("Test");
printAll("Test: %s", "abc");
printAll("Test: %s - %s", "abc", "DEF");
printComplex("Test");
printComplex("Test: %[0]s", new String[] { "abc" });
printComplex("Test: %[0]s - %[0]s", new String[] { "abc" }, new String[] { "DEF" });
String.format("Test");
String.format("Test: %d", 123);
String.format("Test: %d - %s", 123, "DEF");
Object[] data = { "Hello" };
String.format("Test: %s", (Object) data);
String.format("Test: %s", (Object[]) data);
}
public void printAll(String fmt, String... params) {
System.out.println(String.format(fmt, (Object[]) params));
}
public void printComplex(String fmt, String[]... params) {
System.out.println(String.format(fmt, (Object[]) params));
}
}