没有提示错误,但是运行不了,知道怎么办
我的程序如下:
package day2;
public class Course {
String courseID;
String courseName;
String courseType;
int classHour;
float credit;
public Course(String courseID, String courseName, String courseType, int classHour, float credit){
this.courseID = courseID;
this.courseName = courseName;
this.courseType = courseType;
this.classHour = classHour;
this.credit = credit;
}
public void setCourseID(String courseID){
this.courseID = courseID;
}
public String getCourseID(){
return courseID;
}
public void setCourseName(String courseName){
this.courseName = courseName;
}
public String getCourseName(){
return courseName;
}
public void setCourseType(String courseType){
this.courseType = courseType;
}
public String getCourseType(){
return courseType;
}
public void setClassHour(int classHour){
this.classHour = classHour;
}
public int getClassHour(){
return classHour;
}
public void setCredit(float credit){
this.credit = credit;
}
public float getCredit(){
return credit;
}
public void print(){
System.out.println("The basic info of this course as followed:");
System.out.println("the courseID: "+this.getCourseID());
System.out.println("the courseName: "+this.getCourseName());
System.out.println("the courseType: "+this.getCourseType());
System.out.println("the classHour: "+this.getClassHour());
System.out.println("the credit: "+this.getCredit());
System.out.println("------------------------------------------");
}
public static void mian(String[] args){
Course cs = new Course("D13","Java Program Design","CS",64,3.5f);
//Course cs = new Course("D13","Java Program Design","CS",64,3.2不加f就默认double型,错);
System.out.println("------------------------------------------");
cs.print();
cs.setCredit(4.0f);//同上,一定要加f
System.out.println("Alter the credit as a new value 4.0.");
cs.print();
}
}
------解决方案--------------------
没什么特别的呀,怎么会运行不了?
------解决方案--------------------
------解决方案--------------------