我在我的項目中有幾個類。主類應該是我SMSMain.But當我運行該項目時,它沒有發現主類找到錯誤。我試圖在屬性(Netbeans)中設置,但它doesn 「找不到any.where我要去錯在這裏是我的代碼:?沒有找到主要類
package
na.edu.pon.oop210s.s12012.s211045888.sms;
/**
* Student Number: <211045888>
* Date: 3/11/12 7:47 pM
* Exercise: <Exercise 4>
* Created using: <netbeans>
*/
public class sms {
class Student
{
int studentID;
String studentName,course;
public void setName(String studentName){
this.studentName = studentName;
}
public void setNewId(int studentID){
this.studentID = studentID;
}
public void setCourse(String course){
this.course = course;
}
public String toString(){
return studentID +" "+studentName.toString();
}
class lecturer{
int staffID;
String staffName,taughtCourses;
public void setName(String staffName){
this.staffName = staffName;
}
public void setNewId(int staffID){
this.staffID = staffID;
}
public String toString(){
return staffID +" "+staffName.toString();
}
class course{
String code,description;
double units;
course(String code, String CD){
this.code=code.toUpperCase();
description=CD.toUpperCase();
}
public String getCode(){
return code;
}
/**
* @param args the command line arguments
*/
public class SMSMain {
public void main(String[] args) {
// TODO code application logic here
Student a = new Student();
a.studentName = "Maria";
a.studentID = 1236;
System.out.println("Student Name:" + a.studentName);
System.out.println("Student Name:" + a.studentID);
}
}
}}}}
查看答案。將類SMSMain放在它自己的SMSMain.java中。 – 2012-03-18 14:14:50
我已經將SMSMain放在自己的文件中,它看起來不錯,但現在其他類在另一個文件中,並且無法在主類文件中找到。我是否需要插入它們? – kamweshi 2012-03-18 14:27:22
更好的是,Student.java等等。 – 2012-03-18 20:52:39