public class test{
    private String na;
    private static int ct = 0;
    
    public test()
    {}
    
    public void makectbigger()
      {ct++;
        }
        
    public void printCount()
     {System.out.println(ct);
}
}
_______________________________________________
import java.io.*;
public class testmain 
{

public static void main(String args[]) throws IOException
{
test t1 = new test();
test t2 = new test();
test t3 = new test();
t1.printCount();
t1.makectbigger();        // global ct becomes 1
t2.makectbigger();        // global ct becomes 2
t1.printCount();          // prints 2
t2.printCount();          // prints 2
t3.printCount();          // prints 2
}
}