收到ClassNotFoundException错误

时间:2017-03-16 01:48:12

标签: java intellij-idea

我是Java和Intellij的新手,所以我不知道该怎么做这个错误。在我的项目中,有两个类:学生和名册。这是我收到的错误。

enter image description here

这是Roster.java文件

enter image description here

这是Student.java文件

package com.company;

public class Student{

//    Instance variables
    private String studentID;
    private String firstName;
    private String lastName;
    private String email;
    private int age;
    private int[] grades;


//    Constructor
    public Student(String studentID, String firstName, String lastName, String email, int age, int[] grades){
        setStudentID(studentID);
        setFirstName(firstName);
        setLastName(lastName);
        setEmail(email);
        setAge(age);
        setGrades(grades);
    }

//    Accessors (Getters)
    public String getStudentID(){
        return studentID;
    }

    public String getFirstName(){
        return firstName;
    }

    public String getLastName(){
        return lastName;
    }

    public String getEmail(){
        return email;
    }

    public int getAge(){
        return age;
    }
    public int[] getGrades(){
        return grades;
    }

//    Mutators (Setters)
    public void setStudentID(String studentId){
        this.studentID = studentId;
    }

    public void setFirstName(String firstName){
        this.firstName = firstName;
    }

    public void setLastName(String lastName){
        this.lastName = lastName;
    }

    public void setEmail(String email){
        this.email = email;
    }

    public void setAge(int age){
        this.age = age;
    }
    public void setGrades(int[] grades){
        this.grades = grades;
    }

//    Converts integer to a string type, to be used in printing all grades in a string
    public String allGrades(){
        String stringGrade = "";
        for (int grade : grades){
            stringGrade += Integer.toString(grade) + " ";
        }
        return stringGrade;
    }

    public void print(){
        System.out.println("Student ID:\t" + getStudentID() +
                            "First Name:\t" + getFirstName() +
                            "Last Name:\t" + getLastName() +
                            "Email:\t" + getEmail() +
                            "Age:\t" + getAge() +
                            "Grades:\t" + allGrades());
    }
}

我读了关于CLASSPATH的其他帖子,如果这是我的情况,但我无法理解所说的内容。我需要一个更加愚蠢的版本!谢谢!

0 个答案:

没有答案