2014-10-10 102 views
0

这里有一个例子:插值模拟(字符串格式化)

int n1 = 20; 
int n2 = 40; 
String output = String.format("Some guy is **%d** years old while the other is **%d** ", n1, n2); 
System.out.println(output); 

为什么这个不行?

回答

0

我觉得效果很好,当我测试,它会打印为初级讲座:

Some guy is 20 years old while the other is 40