java change boolean to opposite code example Example: java change boolean to opposite theBoolean = !theBoolean;