Challenge: Updating User Information
Swipe to start coding
Your task is to update the fields of the existing person object using setters and getters. Change the name to Bob and set the age to 27.
-
Implement the
getName()andgetAge()methods, as well as thesetName()andsetAge()methods with the appropriate parameters and types. -
Update the name and age using the
setName()andsetAge()methods. -
Print the object with the updated fields to the console.
Lösning
Tack för dina kommentarer!
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Fantastiskt!
Completion betyg förbättrat till 3.57
Challenge: Updating User Information
Svep för att visa menyn
Swipe to start coding
Your task is to update the fields of the existing person object using setters and getters. Change the name to Bob and set the age to 27.
-
Implement the
getName()andgetAge()methods, as well as thesetName()andsetAge()methods with the appropriate parameters and types. -
Update the name and age using the
setName()andsetAge()methods. -
Print the object with the updated fields to the console.
Lösning
Tack för dina kommentarer!
single