/**
   This program demonstates the use of static data members. 

   The following student class has an <code> id </code> field
   which is unique to each instance. 

   @author A. Ozgelen 

   Example from Core Java 
*/

public class Student {
    public static void main ( String[] args ) {
	for ( int i = 0; i < 10 ; i++ ) {
	    Student s = new Student(); 
	    System.out.println("Student " + Integer.toString(i) + 
			       "'s id: " + Integer.toString(s.getId()));
	}
    }

    // constructor
    public Student(){
	id = nextId; 
	nextId++; 
    }
    
    // accessor 
    public int getId() { return id; }
    
    // data fields 
    private final int id; 
    private static int nextId = 1; 
}
