Answer:
import java.io.*;
public class OnOffSwitch
{
public static void main(String[] args)
{
boolean onoffswitch = false;
String value = "false";
if (onoffswitch)
{
value = "true";
onoffswitch = true;
}
else
{
value = "false";
onoffswitch = false;
}
//
System.out.println(value);
}
}
Explanation:
Basically, the simple java program looks through the boolean state and checks, if the boolean value is true, then change the value, otherwise retain the value as default.