我使用NetBeans和我的代碼如下我不斷收到一個錯誤說「無法找到或加載主類gradebooktest.GradeBookTest」我不知道爲什麼
public class GradeBook
{
private String courseName; // course name for this GradeBook
private String courseInstructor; // instructor name for this GradeBook
// constructor initializes courseName and courseInstructor with String Argument
public GradeBook(String name, String insname) // constructor name is class name
{
courseName = name; // initializes courseName
courseInstructor = insname; // initializes courseInstructor
} // end constructor
// method to set the course name
public void setCourseName(String name)
{
courseName = name; // store the course name
} // end method setCourse
// method to retrieve the course name
public String getCourseName()
{
return courseName;
} // end method getCourseName
// method to set the Instructor name
public void setInstructorName(String insname)
{
courseInstructor = insname; // store the Instructor name
} // end method setInstructorName
// method to retrieve the Instructor name
public String getInstructorName()
{
return courseInstructor;
} // end method getInstructorName
// display a welcome message to the GradeBook user
public void displayMessage()
{
// this statement calls getCourseName to get the
// name of the course this GradeBook represents
System.out.println("\nWelcome to the grade book for: \n"+
getCourseName()+"\nThis course is presented by: "+getInstructorName());
System.out.println("\nProgrammed by Jack Friedman");
} // end method displayMessage
} // end
你都爭相推出無主類的應用程序?聽起來很奇怪.. – drgPP 2015-02-24 06:16:41