Write a class Wallet (owner, private balance, deposit, withdraw, toString → Lina: 120) and a public class TransferDemo with three static methods:
boolean transfer(Wallet from, Wallet to, int amount)— refuses amounts ≤ 0 or abovefrom's balance;void swapWallets(Wallet a, Wallet b)— swaps its two parameters;void doubleIt(int value)— doubles its parameter.
main reads two wallets (name balance name balance) and then transfer amounts until the end of input, printing transfer 50: done -> Lina: 50, Omar: 70 (or refused). Finally call swapWallets(first, second) and doubleIt(total) and print
after swapWallets: first is still Lina
after doubleIt: total is still 120
Explain in one sentence why transfer works but the other two do not.