简单java类
package test;
//设计用户User类:用户名、口令、用户数量个数
class User{
private String uid;
private String password;
private static int count=0;//累积计数
public User() {
this("NOID","mldn");
}
public User(String uid) {
this(uid,"mldnjava");
}
public User(String uid,String password) {
this.uid=uid;
this.password=password;
count++;
}
public static int getCount() {
return count;
}
}
public class JavaDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
User userA=new User();
System.out.println(User.getCount());
}
}