为什么程序不报错,但不能执行...
package light;public class light {
/**
* @param args
*/
//public static void main(String[] args) {
// TODO Auto-generated method stub
//public class Light {
private int watts;
private boolean indicator;
//int watts;
//boolean indicator;
public light(int watts) {
this.watts = watts;
}
public light(int watts, boolean indicator) {
super();
this.watts = watts;
this.indicator = indicator;
//this.watts = 230;
//this.indicator = true;
}
public void switchOn()
{
this.indicator = true;
}
//开灯,即将灯的状态置为开
public void switchOff()
{
this.indicator = false;
}
//关灯
public void printInfo()
{
System.out.println("灯的瓦数是:" + this.watts + "\n开关状态是:" + this.indicator);
}
//输出灯的瓦数信息和开关状态
}