解题思路:
注意事项:
参考代码:
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 人评分
点我有惊喜!你懂得!浏览:1219 |
C语言训练-斐波纳契数列 (C语言代码)浏览:2809 |
大神老白 (C语言代码)浏览:712 |
C语言训练-角谷猜想 (C语言代码)浏览:1705 |
【出圈】 (C语言代码)浏览:553 |
ASCII帮了大忙浏览:748 |
字符串对比 (C语言代码)浏览:1398 |
Wu-求圆的面积 (C++代码)浏览:1883 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:349 |
文科生的悲哀 (C语言代码)浏览:1397 |
Fare丶梦 2017-08-22 10:03:37 |
这类似于Scanner sc = new Scnner(System.in); int n = sc.nextInt; String类型的输入方式有两种,,一种是next(),,,,一种是nextLine(),,,nextLine()会读取你输入回车前所有输入的数据(包括空格),,而next()不会读取空格后的回车内容