Tutorial wrote:the prefix version (++result) evaluates to the incremented value, whereas the postfix version (result++) evaluates to the original value.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Mike Osterhout wrote:I am trying to add a counter to my inventory objects. The first inventory object will be 1, second 2 and so on.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Mike Osterhout wrote:Ok, let me apologize for all of the questions.
Mike Osterhout wrote:What is up with this syntax? I have never seen this...
5. new Store();
6. }
7.
8. Store() {
I see that you are creating a new Store, but why the second store?
Mike Osterhout wrote:Also I wasent aware that you could access varibles of the class in this manner, good to know.
(stock[i].id + " of " + Inventory.itemCount)
Mike Osterhout wrote:Lastly, I thought it was pretty cool how you did this.
20. static int itemCount = 0;
21. int id = itemCount++;
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |