2014-10-10 104 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