public class User { private int id; private String username; private String password; private String emailAdrr; private static int totalUser = 0; public User(int id, String password) { this.id = id; this.password = password; this.emailAdrr = username + "@gameschool.com"; totalUser++; } public static void main(String[] args) { User user1 = new User(1, "password1"); User user2 = new User(2, "password2"); User user3 = new User(3, "password3"); System.out.println("用户总人数: " + totalUser); } }

Java 网络用户类定义与实例化 - 包含用户 ID、用户名、密码和邮箱

原文地址: https://www.cveoy.top/t/topic/pTHI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录