[英]Main method not found in scanner class
import java.util.Scanner;
class ScannerTest{
public static void name(String[] args) {
Scanner scan = new Scanner(System.in);
short a[][] = {{1,2,3},{4,5,6},{7,8,9}};
short b[][] = new short[3][3];
System.out.println("Enter the matrix B:");
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
b[i][j] = scan.nextShort();
}
}
short c[][] = new short[3][3];
int n = a.length;
for (int i=0; i<3; i++)
{
System.out.println();
for (int j=0; j<3; j++)
{
for (int k=0; k<3; k++)
{
c[i][j] +=(a[i][k]*b[k][j]);
}
System.out.print(c[i][j] + " ");
}
}
}
}
当我编译并运行代码时,它说在 class ScannerTest 中找不到主要方法,请将方法定义为 public static void main(String[] args)。 如果有人能指出问题所在,我不知道如何解决这个问题将不胜感激。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.