Discuss / Java / 练习

练习

Topic source

刘晋呈php

#1 Created at ... [Delete] [Delete and Lock User]

public class Person {

    // TODO    String name;
    
    //静态属性 count     
public static int count;

    public Person(String name) {
        this.name = name;
        Person.count++;
    }
   
    //静态方法    
public static int getCount() {
        return Person.count;
    }
}

  • 1

Reply