带有参数的格式化字符串
public static void main(String[] args) {
// TODO Auto-generated method stub
String aa = String.format("where name=%s and thename like '%%%s%%' and aa=%s", "yohen","10","aa");
System.out.print(aa);
}
输出结果 where name=yohen and thename like '%10%' and aa=aa;
也就是说如果要格式化带有“%”的字符串,“%”则需变为“%%”。