Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person extends Student {
- private String name;
- private int DoB = 0;
- public Person(String name, int DoB) {
- this.name = name;
- this.DoB = DoB;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getDoB() {
- return DoB;
- }
- public void setDoB(int DoB) {
- this.DoB = DoB;
- }
- public String toString() {
- return "Person [name=" + this.name + ", DateOfBirth=" + this.DoB + "]";
- }
- public void printState() {
- System.out.println(toString());
- }
- public static void main(String[] args) {
- Person p = new Person("Danil", 1995);
- System.out.println(p.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement