Java - Constructors Create a class named Person that has the attributes: First name - String Last name - String Gender - String Age - Integer Address - String Create two constructors: one that accepts the first name and last name only and one that accepts all attributes. Accept inputs for all attributes and create two objects that use each constructor. Print their attributes. Inputs 1. Enter first name 2. Enter last name 3. Enter gender 4. Enter age 5. Enter address Marceus Azalithen Male 20 Azalithzith Sample Output Enter first name: John Enter last name: Doe Enter gender: Male Enter age: 19 Enter address: JDoe Object 1 First name: John Last name: Doe Gender: Age: Address: Object 2 First name: John Last name: Doe Gender: Male Age: 19 Address: JDoe
Java - Constructors
Create a class named Person that has the attributes:
First name - String
Last name - String
Gender - String
Age - Integer
Address - String
Create two constructors: one that accepts the first name and last name only and one that accepts all attributes. Accept inputs for all attributes and create two objects that use each constructor. Print their attributes.
Inputs
1. Enter first name
2. Enter last name
3. Enter gender
4. Enter age
5. Enter address
Marceus
Azalithen
Male
20
Azalithzith
Sample Output
Enter first name: John
Enter last name: Doe
Enter gender: Male
Enter age: 19
Enter address: JDoe
Object 1
First name: John
Last name: Doe
Gender:
Age:
Address:
Object 2
First name: John
Last name: Doe
Gender: Male
Age: 19
Address: JDoe
Step by step
Solved in 2 steps with 1 images