Complete the following class to implement all the methods in the class
- Complete the following class to implement all the methods in the class:
public class Person {
String name;
int birthYear;
public Person() {
name = "unknown";
birthYear = 2000;
}
public Person(String givenName, int yearOfBirth) {
//put your implementation for this method
}
public String getName() {
//put your implementation for this method
}
public String changeName(String newName) {
//put your implementation for this method
}
public int getAgeInYears(int currentYear) {
//put your implementation for this method
}
public static void main(String[] args) {
//Create a new Person object called person1; name is Ahmed, and his birth year 1995
// Create a new Person object called person2; name is Rami, and his birth year 2000
//print the age of the first person
}
}
Step by step
Solved in 2 steps with 1 images