public class Bicycle { ... public static int instances = 0; { ++instances; //separate counting from constructor } ... public Bicycle(int gear, int speed, int seatHeight, String color) { gear = 0; speed = 0; seatHeight = 0; color ="Unknown"; } }