jeudi 21 avril 2016

How to make this boolean statement false through Java Reflection

I have to use reflection.

In my ATM class I have two variables:

   private int userBalance = 100;
   private int moneyInMachine = 100000;

I would like to withdraw an unlimited amount of money.

Here is the ATM's withdraw function:

private void widthdrawAmount(int n) {
    if (this.userBalance - n < 0 || this.moneyInMachine - n < 0) {
       // You can not pull money out.
    }

    this.updateScreen();
}

I was wondering if anyone knows a way to take this boolea statement false.





Aucun commentaire:

Enregistrer un commentaire