public void doChangePin(int oldPin, int pin) throws Exception { //need to add throws followed by exception name
if (oldPin == pinCode) {
pinCode = pin;
} else {
throw new Exception("some message"); //throwing the exception by creating its new object
}
}