class Car {
staticint frogCount = 0; // Declare and initialize static variable
public Car() {
frogCount += 1; // Modify the value in the constructor
}
}
publicclass MainClass {
publicstaticvoid main (String [] args) {
new Car();
new Car();
new Car();
System.out.print("frogCount:"+Car.frogCount); //Access static variable
}
}