Workbook 7.2
From the Java Bootcamp Resources
, launch Workbook 7.2
.
Task 1
Create a Person
constructor that receives four parameters. For now, ignore passport
.
public Person(String name, String nationality, String dateOfBirth, int seatNumber) {
// set fields equal to parameters here.
}
Task 2
Remove the field updates from Part 1.
While a new
object is being created, use the constructor to update its fields.
Task 3
Print every field as part of one String
.
System.out.println("Name: " + <name field> + "\n" + "Nationality: " + <nationality field> + "\n" + "Date of Birth: " + <birth date field> + "\n" + "Seat Number: " + <seat number field> + "\n");
>>: Name: Rayan Slim
>>: Nationality: Canadian
>>: Date of Birth: 01/01/1111
>>: Seat Number: 5
Visualizing the Runtime
After you solve this workbook, I still recommend watching the video solution on Udemy.
It will show you how to visualize the runtime using Visual Studio Code.
Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
Feedback Summary
4.7
43 students
5
91%
4
2%
3
0%
2
0%
1
7%
Written Reviews
There are no written reviews yet.