//抽象类AbstractTest
package help;
public abstract class AbstractTest {
abstract void dispTest();
}
//子类:StudentTest
package help;
public class StudentTest {
private String name;
private int num;
private int score;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public StudentTest() {
}
public StudentTest(String name, int num, int score) {
this.name = name;
this.num = num;
this.score = score;
}
public void dispTest() {
StudentTest st = new StudentTest(name, num, score);
String name = st.getName();
int num = st.getNum();
int score = st.getScore();
System.out.println("姓名:" + name + "\n" + "学号:" + num + "\n" + "分数:"+ score);
}
public static void main(String[] args) {
StudentTest st = new StudentTest("科比", 24, 81);
st.dispTest();
}
}
public abstract class AbstractTest {
public abstract void dispMessage();
}
public class StudentTest extends AbstractTest {
public String name;
public String id;
public Integer score;
public StudentTest(){
}
public StudentTest(String name,String id,Integer score){
this.name=name;
this.id=id;
this.score=score;
}
public void dispMessage() {
}
}
public abstract class AbstractTest {
abstract void dispMessage();
}
public abstract class AbstractTest {
abstract void dispMessage();
}