โ Back to Encapsulation
Question 480
Backing Field Property
Backing Field Property
TheThermostatclass has a private fieldtemperature. Add a public propertyTemperaturewhosegetreturns the field and whosesetstoresvalueinto the field. The tester assigns 72 and prints it. Do NOT write aMainmethod. ForTemperature = 72the program prints: 72
Expected Output:
72
Topics:
Encapsulation
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.