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