Question
Modify the BankAccount class (given in textbook Starting out with java 6 th edition, chapter 7) as follows: 1) Add an appropriate toString method; 2)
Modify the BankAccount class (given in textbook Starting out with java 6 th edition, chapter 7) as follows: 1) Add an appropriate toString method; 2) Add an appropriate equals method; 3) Add a copy constructor; 4) Add an integer objectID field to each BankAccount object---this field should contain a sequential unique numeric ID that is assigned to each object when it is created (the very first object should have an ID of 1001; 5) Add a static method named objectsInMemory() that returns the number of BankAccount objects that are currently in memory; 6) Use a finalize() method to keep track of objects that are reclaimed by the garbage collector so that such reclaimed objects are not counted as being objectsInMemory. Write a small demo class that demonstrates your modified BankAccount class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started