输入以下内容后, sb.append(sc.nextLine().split(":")[1]).append(" ");这个语句中的[1]是什么意思,为什么输出的内容没有gcs cxy sds?
3
gcs:java js php
cxy:js python c++
sds:c++ c js
代码:
int n = sc.nextInt();
sc.nextLine();
StringBuilder sb = new StringBuilder();
for(int i=0;i<n;i++){
sb.append(sc.nextLine().split(":")[1]).append(" ");
}
System.out.println(sb);
输出结果:
java js php js python c++ c++ c js