還有是java後面的數字, 是因為輸入了該數字而出了錯誤嗎?
執行時發生錯誤(code:1)!!
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:817)
at java.util.Scanner.next(Scanner.java:1431)
at java.util.Scanner.nextInt(Scanner.java:2040)
at java.util.Scanner.nextInt(Scanner.java:2000)
at code_384400.main(code_384400.java:13)
import java.util.Scanner;
public class JAVA
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int r, c;
while (true)
{
r=sc.nextInt();
c=sc.nextInt();
int a[][]=new int[r][c];
int b[][]=new int[c][r];
for (int i=0; i<a.length; i++)
{
for (int j=0; j<a[i].length; j++)
{
b[j][i]=sc.nextInt();
}
}
for (int i=0; i<b.length; i++)
{
for (int j=0; j<b[i].length; j++)
{
if (j<b[i].length-1)
{
System.out.print(b[i][j] + " ");
}
else
{
System.out.print(b[i][j]);
}
}
System.out.println();
}
}
}
}