在我的构造函数中获取错误

时间:2014-05-25 21:30:52

标签: java

在我的课程作业中,我需要为Matrix创建一个构造函数,并且我得到一个我不熟悉的错误......

这是错误:

Multiple markers at this line
    - Method breakpoint:Matrix [entry] - Matrix(int, 
     int)
    - Syntax error on token "public", delete this 
     token

这是我的代码:

import java.util.Scanner;

public class Matrix {

    private int [][] data;
    private Scanner 

    // Class constructor - can be created only when a user provide positive columns and rows
    public Matrix(int r, int c) throws DidNotProvideMatrixData
    {
        if (r <= 0 || c <= 0) {
            throw new DidNotProvideMatrixData("Rows and Columns have to be positive!");
        } else {
            this.data = new int[r][c];
        }
    }

由于

1 个答案:

答案 0 :(得分:2)

私人扫描仪? 您缺少一个varname和一个;

修好后,它应该编译得很好。