Community
Participate
Working Groups
public static void main(String[] args) { System.out.print("@12"); ///可以在输出参数后面加\n来换行 System.out.print("@123\n"); ///也可以在输出参数(或者变量)后面加上+"\n"来换行 System.out.print("@1231"+"\n"); System.out.printf("%s","@1234"); ///可以在格式化输出类型后面加\n来换行 System.out.printf("%s\n","@12345"); ///可以在格式化输出类型%n来指定输出一行,其效果等同于println System.out.printf("%s%n","@123451"); System.out.printf("%s%%","null@123451"); System.out.println(); System.out.printf("++++++输出%%%"+"nullnull$"+".2"+"fd:"+" %1$.2f ",2019.0101); ///也可以在输出参数(或者变量)后面加上+"\n"来换行 System.out.printf("\n"+"%s","@123456"+"\n"); ///println()相当于printf(\n\n),即另起一行输出对应的参数后,再进行一次换行 System.out.println("@1234567"); // TODO Auto-generated method stub } } output: @123451 null@123451% ++++++输出% ullnull$.2fd: 2019.01 @123456 @1234567
System.out.printf("%s%%","null@123451"); output: null@123451% And why did there hava a "%"? But System.out.printf("++++++输出%%%"+"nullnull$"+".2"+"fd:"+" %1$.2f ",2019.0101); output: ++++++输出% ullnull$.2fd: 2019.01 If it is right,what is the rule?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
@Paul, Do you want to have a look at this? System.out.printf("%s%%","null@123451"); output: null@123451%