我无法找出此代码跳过scan.nextLine()的原因... 我对该行发表评论......当我去调试器并跳过它时,我不允许输入字符串数据..
import java.util.Scanner;
public class Main {
public static void main(String[] args){
int x =0, y=0;
char path[][];
Scanner scan = new Scanner(System.in);
x = scan.nextInt();
y = scan.nextInt();
path = new char[x][y];
String[] input = new String[y];
for(int i = 0; i < x; i++){
input[i] = scan.nextLine(); // this line is skipped...
for(int yIndex = 0; yIndex < input.length; yIndex++){
path[i][yIndex] = input[i].charAt(yIndex);
}
}
}