Specifications
Sun Services
Java™ Programming Language
Module 7, slide 7 of 44
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Class Methods
You can create static methods:
1 public class Count2 {
2 private int serialNumber;
3 private static int counter = 0;
4
5 public static int getTotalCount() {
6 return counter;
7 }
8
9 public Count2() {
10 counter++;
11 serialNumber = counter;
12 }
13 }










