Use the class definition below to determine if each of the public class LightBul
ID: 3816382 • Letter: U
Question
Use the class definition below to determine if each of the public class LightBulb {private Public Boolean on; public Light Bulb () {on = False;} public void change() {on = ion;} public Boolean isOn() {return on;} public String toString() {String result = "Light is"; if(on) return result + "on" else return result + "off"} public static void main (String [] args) {LightBulb.change();//a LightBulb 1t = new LightBulb(40)l//b LightBulb b1b = new LightBulb();//c System.out.println(b1b);//d on = b1b.isOn();//e if(b1b.isOn == true)//f change();//g else if (isOff(b1b))//h System.out.println(b1b.change());//i LightBulb = b1b.change();//j}}Explanation / Answer
Below are the errors
a) non-static method change() cannot be referenced from a static context
b) constructor LightBulb in class LightBulb cannot be applied to given types;
c) Ok
d) Ok
e) non-static variable on cannot be referenced from a static context which is on
f) cannot find symbol
g) non-static method change() cannot be referenced from a static context
h) cannot find symbol
i) 'void' type not allowed here
j) cannot find symbol
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.