public class Cat {
private static int catCount = 0;
public void addNewCat() {
catCount++;
}
public static void main(String[] args) {
Cat cat = new Cat();
cat.addNewCat();
System.out.println(catCount);
}
}
The number of cats is increased by one
package com.codegym.task.task04.task0404;
/*
Cat register
*/
public class Cat {
private static int catCount = 0;
public void addNewCat() {
catCount++;
}
public static void main(String[] args) {
Cat cat = new Cat();
cat.addNewCat();
System.out.println(catCount);
}
}