Use “static”
Using the prefix qualifier static means that there is only ONE field noEmps for the whole class, not one for each instance of the class:public class Employee {static public int noEmps= 0; //Number Employees ever createdpublic String name; //Employee’s name// Constructor -- An Employee named npublic Employee(String n) { noEmps= noEmps+1; name= n;} // Return no. of Employees ever createdpublic int getNoEmps() {return noEmps;}}