public int getid return id return this accounts

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: = initial_balance; } How can static variables help you? } ... public int getID() { return id; } // return this account's id 1 4/27/13 Static variables q༇  Initializing static variables 1.  2.  Do nothing. variable is initialized with 0 (for numbers), false (for boolean values), or null (for objects) Use an explicit initializer, such as public class BankAccount { ... private static int lastAssignedNumber = 1000; // Executed once } q༇  Static variables should usually be declared private Figure from: Big Java by Cay Horstmann Static variables q༇  Exception: Static constants, which may be either private or public: q༇  public class BankAccount { ... pub...
View Full Document

This note was uploaded on 02/10/2014 for the course CS 161 taught by Professor Boese during the Spring '08 term at Colorado State.

Ask a homework question - tutors are online