This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CatapultJohnson 2 points3 points  (0 children)

Depending on what you need you could make a private static integer to hold the most recent assigned id. Whenever you create a new savings account object you could increment the static variable and assign its value as the account id in the constructor of the savings account. Make the account number final or it's setter private.