A field to count the amount instances of a class [duplicate]
问题 This question already has answers here : post increment operator java (3 answers) Closed 6 years ago . I need to create a field to count the number of instances made by a class public class Circle { private int diameter; private int xPosition; private int yPosition; private String color; private boolean isVisible; private static int count = 0; /** * Create a new circle at default position with default color. */ public Circle() { diameter = 30; xPosition = 20; yPosition = 60; color = "blue";