/**
   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 TestStatic{
    public static void main ( String[] args ) {
	for ( int i = 0; i < 10 ; i++ ) {
	    Student s = new Student(); 
	    System.out.println("Student " + i + "'s id: " + s.getId());
	}
    }
}

class Student {
    public Student(){
	id = nextId; 
	nextId++; 
    }

    public int getId() { return id; }
    
    private final int id; 
    private static int nextId = 1; 
}
