我写的木有用到方法重载的。。。有继承。
class Person
{
private String name;
private int age;
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
}
class Student extends Person
{
private String stuID;
private int course1;
private int course2;
private int course3;
private int course4;
private int course5;
public Student(String name, int age, String stuID)
{
super(name, age);
this.stuID = stuID;
this.course1 = 0;
this.course2 = 0;
this.course3 = 0;
this.course4 = 0;
this.course5 = 0;
}
public void setCourse1(int mark)
{
this.course1 = mark;
}
public void setCourse2(int mark)
{
this.course2 = mark;
}
public void setCourse3(int mark)
{
this.course3 = mark;
}
public void setCourse4(int mark)
{
this.course4 = mark;
}
public void setCourse5(int mark)
{
this.course5 = mark;
}
public void getFlunk()
{
if(course1 <= 60)
{ System.out.println("course1:" + course1);}
if(course2 <= 60)
{ System.out.println("course2:" + course2);}
if(course3 <= 60)
{ System.out.println("course3:" + course3);}
if(course4 <= 60)
{ System.out.println("course4:" + course4);}
if(course5 <= 60)
{ System.out.println("course5:" + course5);}
}
}
你问题都没说清楚,要从数据 库读出不及格数据? 还是什么东西