注意:此页面搜索的是所有试题
以下程序的输出结果为_____。
public class Course {
private String cNumber;
private String cName;
private int cUnit;
public Course(String number, String name, int unit) {
cNumber = number;
cName = name;
cUnit = unit;
}
public void printCourseInfo() {
System.out.println("课程号:" + cNumber + " 课程名:" + cName + " 学分:" + cUnit);
}
}
class CourseTest {
public static void main(String[] args) {
Course c;
c = new Course("101", "ASP", 3);
c.printCourseInfo();
}
}
public class Course {
private String cNumber;
private String cName;
private int cUnit;
public Course(String number, String name, int unit) {
cNumber = number;
cName = name;
cUnit = unit;
}
public void printCourseInfo() {
System.out.println("课程号:" + cNumber + " 课程名:" + cName + " 学分:" + cUnit);
}
}
class CourseTest {
public static void main(String[] args) {
Course c;
c = new Course("101", "ASP", 3);
c.printCourseInfo();
}
}
参考答案