Student and Person have a lot of overlapping qualities such as name, age, name and age.


<aside> 💡 Student class can inherit all the characteristics of the Person class (avoiding repetition) because the Student is a person with more variables and methods

</aside>

Overriding methods: the main class will look for the method that is closest to it, it will look for the method in the Student class first, if it is not there it will look for the method in the Person class.

//PERSON
public class Person{
	private String name;
	private int age;
	
	public Person(){
	name = "Name Missing";
	age = 0;
	}
	
	//modifer and acessor methods
}

//STUDENT
public class Student extends Person{ //extends key word tells the student that it is a person
// all of the constructor, modifier and acessor methods from Person become available to the Student
	private int studentNumber
	public Student(){ 
		super(); //call on the Person constructor
		//if there are overloaded constructors, use matching constructor parameters to match super() parameters
		studentNumber = 335648705;
	}

	public void setStudentNumber(int n){
		studentNumber = n;
	}

	public void getStudentNumber(){
		return studentNumber;
	}
	
	public void yearOfBirth(){
		return 2021-super.getAge();
		//calling super in the subclass is like calling a class method in the main method
	}
}

private static final double PI = 3.14;
private double radius;

polymorphism

animal survival to-do