CJCoding With Joseph

Getter and Setter Methods

Create a class Thermostat with a private int field temperature. Add a SetTemperature(int value) method that stores the value and a GetTemperature() method that returns it. Do not write a Main method.

After SetTemperature(72) the 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.