Solved

Assume the Method Below Has Been Added to the BankAccount

Question 84

Multiple Choice

Assume the method below has been added to the BankAccount class. public void transfer (BankAccount source, double amount)
{
Balance = balance + amount;
Source.balance = source.balance - amount;
}
What will be output from the following statements that use the revised BankAccount class?
BankAccount first = new BankAccount (100.0) ;
BankAccount second = new BankAccount (300.0) ;
First.transfer (second, 50.0) ;
System.out.println (first.getBalance() + " "
+ second.getBalance() ) ;


A) 100.0 300.0
B) 150.0 250.0
C) 150.0 300.0
D) 100.0 250.0

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents