Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package myworld;
- /**
- *
- * @author fmi
- */
- public abstract class Person implements Introducable {
- protected String name;
- protected int age;
- public static final double PI = 3.14; // constant
- public static String nationality = "Bulgarian";
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getAge() {
- return age;
- }
- public void setAge(int age) {
- this.age = age;
- }
- public Person(String name, int age){
- this.name = name;
- this.age = age;
- }
- public Person() {
- this("Anonymous", 0);
- }
- @Override
- public void introduceYorSelf()
- {
- System.out.println("I am a person! My name is " + name + ". I am " + age + " years old! I am " + nationality);
- }
- // public abstract void doTest();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement