computing
  • 2

What Does The Following Method Do? Give Example

  • 2

What does the following method do? Give an example of how you can cal lthe method.
public class BankAccount {
public void mystery(BankAccount that, double amount) {
this.balance = this.balance – amount;
that.balance = that.balance + amount; }
. . . // Other bank account methods }

Share

1 Answer

  1. Actually that code does no effect to the source bank account. mystery is a function that accepts 2 parameters, the bank account (probably a data structure or aggregate) and the amount in double precision decimal.
    For instance, from another point in the program, you want to call that function. Simply type in mystery(mybankaccount, 63727.28);.
    • -1