Java Bootcamp Resources, launch
toString method to the
Person class. Return a
String that follows this template:
"Name: " + <name field> + "\n" + "Nationality: " + <nationality field> + "\n" + "Date of Birth: " + <date of birth field> + "\n" + "Seat Number: " + <seat number field> + "\n" + "Passport: " + <toString of passport field> + "\n";
Print your object. Java should internally call
toString and print its return value.
>>: Name: Rayan Slim >>: Nationality: Canadian >>: Date of Birth: 01/01/1111 >>: Seat Number: 5 >>: Passport: [Rayan Slim, Canadian, 01/01/1111]
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.