PROGRAMMING:Jmu-java-03 object oriented foundation-05-overlay
Every object in Java inherits from object and has methods such as equals and toString.
Now you need to define the 'personoverride' class and override its' toString 'and' equals' methods.
###1. Create a new * * personoverride * * class
a. * * attribute * *:'string name ','int age','boolean gender '. All variables must be private.
b. * * parameterized constructor * *, parameters are 'name, age, gender'`
c. * * nonparametric constructor * *, use 'this (name, age, gender)' to call the parametric constructor. The parameter values are respectively '"default", 1 and true`
d. The return format of the 'tostring()' method is: 'name age gender'`
e. The 'equals' method returns' true' only when the contents of name, age and gender are the same
###2. Main method
2.1 input N1, create N1 objects with nonparametric constructor, and put them into the array persons1.
2.2 enter N2 and specify 'name age gender'. Every time an object is created, the equals method is used to compare whether the object already exists in the array. If not, the object is put into the array persons2.
2.3 output all objects in the persons1 array
2.4 output all objects in the persons2 array
2.5 output the number of objects actually contained in persons2
2.5 use ` system. Out. Println (arrays. ToString (personoverride. Class. Getconstructors())` Output all constructors of personoverride.
**Tip: * use 'ArrayList' instead of array to simplify the code greatly. Please try to refactor your code.
###Input example:
```in
one
three
zhang 10 true
zhang 10 true
zhang 10 false
```
###Output example:
```out
default-1-true
zhang-10-true
zhang-10-false
two
[public PersonOverride(), public PersonOverride(java.lang.String,int,boolean)]
```
answer:If there is no answer, please comment
Now you need to define the 'personoverride' class and override its' toString 'and' equals' methods.
###1. Create a new * * personoverride * * class
a. * * attribute * *:'string name ','int age','boolean gender '. All variables must be private.
b. * * parameterized constructor * *, parameters are 'name, age, gender'`
c. * * nonparametric constructor * *, use 'this (name, age, gender)' to call the parametric constructor. The parameter values are respectively '"default", 1 and true`
d. The return format of the 'tostring()' method is: 'name age gender'`
e. The 'equals' method returns' true' only when the contents of name, age and gender are the same
###2. Main method
2.1 input N1, create N1 objects with nonparametric constructor, and put them into the array persons1.
2.2 enter N2 and specify 'name age gender'. Every time an object is created, the equals method is used to compare whether the object already exists in the array. If not, the object is put into the array persons2.
2.3 output all objects in the persons1 array
2.4 output all objects in the persons2 array
2.5 output the number of objects actually contained in persons2
2.5 use ` system. Out. Println (arrays. ToString (personoverride. Class. Getconstructors())` Output all constructors of personoverride.
**Tip: * use 'ArrayList' instead of array to simplify the code greatly. Please try to refactor your code.
###Input example:
```in
one
three
zhang 10 true
zhang 10 true
zhang 10 false
```
###Output example:
```out
default-1-true
zhang-10-true
zhang-10-false
two
[public PersonOverride(), public PersonOverride(java.lang.String,int,boolean)]
```
answer:If there is no answer, please comment