public class InheritanceDemo
1: //InheritanceDemo.java
2:
3: public class InheritanceDemo
4: {
5: public static void main(String[] args)
6: {
7: Student s = new Student();
8: s.writeOutput();
9: System.out.println();
10:
11: s.setName("Warren Peace");
12: s.setStudentNumber(1234);
13: s.writeOutput();
14: System.out.println();
15:
16: Person p = new Person();
17: p.writeOutput();
18: System.out.println();
19:
20: Person pp = new Student();
21: pp.writeOutput();
22:
23: Student pp = new Person(); //illegal Why?
24: }
25: }