October 2017
Intermediate to advanced
396 pages
10h 2m
English
I am going to create an abstract Account class and concrete classes extending the Account class. An AccountCache class is defined as a next step, which stores account objects in a HashMap and returns their clone when requested. Create an abstract class implementing the Clonable interface.
package com.packt.patterninspring.chapter2.prototype.pattern; public abstract class Account implements Cloneable{ abstract public void accountType(); public Object clone() { Object clone = null; try { clone = super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return clone; } }
Now let's create concrete classes extending the preceding class:
Here's the CurrentAccount.java
Read now
Unlock full access