java System.out.printf输出注意

问题:oj 提交时 System.out.printf("\n");  提示格式错误; 

c++ 中 printf("\n"); 输出时走msvcrt.dll, 在这里面,会将\n转成\r\n (win下的换行符)

但是java不会。 所以输出换行时可以采用 System.out.printf("\r\n"); 

 建议:Java里的printf,不要\n,用%n;


                                                                                       注:感谢acdream中的]新八唧菊苣讲解



猜你喜欢

转载自blog.csdn.net/wangzhuo0978/article/details/64440263
今日推荐