โ Back to Classes
Question 97
Create a Lamp Class
Create a Lamp Class
Create a class named Lamp with one private member: boolean isOn. Requirements: 1. Make a default constructor Lamp() that sets isOn to true. 2. Create a public method getIsOn() that returns isOn. IMPORTANT: Do NOT write a main method for this question. Your class will be tested with a hidden Main class that creates a Lamp object and prints getIsOn(). Expected Output: true
Expected Output:
true
Topics:
Classes
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.