- abstract class Person
- {
- public Person()
- {
- this.empt();
- }
- public abstract void empt();
- }
- class Students extends Person
- {
- private int score = 20;
- public Students(int score)
- {
- this.score = score;
- }
- public void empt()
- {
- System.out.println(" score = "+ score);
- }
- }
- class Demo
- {
- public static void main(String[] args)
- {
- Person per = new Students(6);
- }
- }
-
复制代码 |
|