Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class Person {
- final String id;
- final String name;
- private String info = "I'm a " + this.getClass().getSimpleName() + ". My ID is " + this.id
- + " and my name is " + this.name;
- public Person(String id, String name) {
- this.id = id;
- this.name = name;
- }
- public String getInfo() {
- return this.info;
- }
- }
- public final class Teacher extends Person {
- public Teacher(String id, String name) {
- super(id, name);
- }
- }
- public final class Student extends Person {
- public Student(String id, String name) {
- super(id, name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement