【发布时间】:2011-12-11 15:42:14
【问题描述】:
【问题讨论】:
-
如果上一个问题的答案对您来说没有意义,那是因为您的问题不清楚。您应该编辑上一个问题以使其更清楚。如果您只是提出一个新问题,它很可能会因为重复而被关闭。
-
System.out.println("I\nam\nboy");
【问题讨论】:
System.out.println("I\nam\nboy");
class NewLiner {
public static void main(String[] args) {
String test = "0 2 4 6 8 10";
char[] cs = test.toCharArray();
int step = 10;
int count = (int) (cs.length / step);
int limit = count * step + 1;
for (int i = step - 1; i < limit; i+= step) {
if (Character.isWhitespace(cs[i])) {
cs[i] = '\n';
}
}
System.out.println(new String(cs));
}
}
【讨论】: