解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static String[] input(){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
sc.nextLine();
String[] array = new String[N];
for(int i=0;i < N;i++){
String str = sc.nextLine();
str = str.replaceAll(" ", ",");
array[i] = str;
}
return array;
}
public static void print(String[] array){
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
public static void main(String[] arg){
print(input());
}
}
0.0分
0 人评分
C二级辅导-温度转换 (C++代码)浏览:583 |
数字整除 (C语言代码)浏览:660 |
【作业调度方案】 (C语言代码)浏览:881 |
C语言程序设计教程(第三版)课后习题6.4 (C++代码)浏览:547 |
【C语言训练】8除不尽的数 (C++代码)浏览:504 |
C二级辅导-同因查找 (C语言代码)浏览:458 |
【C语言训练】求素数问题 (C语言代码)浏览:823 |
C语言考试练习题_保留字母 (C语言代码)浏览:568 |
【C语言训练】排序问题<2> (C++代码)(sort函数)浏览:937 |
C语言程序设计教程(第三版)课后习题8.4 (Java代码)浏览:640 |
Fare丶梦 2017-08-22 10:03:37 |
这类似于Scanner sc = new Scnner(System.in); int n = sc.nextInt; String类型的输入方式有两种,,一种是next(),,,,一种是nextLine(),,,nextLine()会读取你输入回车前所有输入的数据(包括空格),,而next()不会读取空格后的回车内容