解题思路:
注意事项:
参考代码:
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++代码)浏览:689 |
C语言程序设计教程(第三版)课后习题6.3 (Java代码)浏览:679 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:563 |
求圆的面积 (C语言代码)浏览:1328 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:714 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:550 |
C语言训练-数字母 (C语言代码)浏览:665 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:508 |
演讲大赛评分 (C语言代码)浏览:1667 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:727 |
Fare丶梦 2017-08-22 10:03:37 |
这类似于Scanner sc = new Scnner(System.in); int n = sc.nextInt; String类型的输入方式有两种,,一种是next(),,,,一种是nextLine(),,,nextLine()会读取你输入回车前所有输入的数据(包括空格),,而next()不会读取空格后的回车内容