Write 2 lines of Java code that will create a Bank object for yourself and initialize both your checking and your savings account to $1 million.
assuming the bank object has checking and savings variables. Bank myBank = new Bank(); myBank.Checking, myBank.Savings = 1000000.00;
Heh well we will have to assume that Bank is a class to do Bank myBank = new Bank(); or else Object bank; Next for the 1 million you would need to do, int Checking = 1,000,000, Savings 1,000,000. As stated above you would also assume that checking/savings are both methods in Bank. You still need to say both = 1 million. Also if you had a constructor for the class it could be int Checking = 1,000,000, Savings 1,000,000. Bank b = new Bank(Checkings, Savings); or even ank b = new Bank(1,000,000, 1,000,000);
Join our real-time social learning platform and learn together with your friends!