第23天
一、标准的Javabean
如下我们编写一个标准JavaBean模板。
package Test4; public class user { private String username; private String key; private String email; private String gender; private int age; public user() { } public user(String username, String key, String email, String gender, int age) { this.username = username; this.key = key; this.email = email; this.gender = gender; this.age = age; } public void setUsername(String username) { this.username = username; } public String getUsername() { return username; } public void setKey(String key) { this.key = key; } public String getKey() { return key; } public void setEmail(String email) { this.email = email; } public String getEmail() { return email; } public void setGender(String gender) { this.gender = gender; } public String getGender() { return gender; } public void setAge(int age) { this.age = age; } public int getAge() { return age; } }
二、对象的内存图
栈区先进后出。即以下图是先消失study方法,然后消失main方法,然后main内所相应的变量也消失释放,最终方法区也释放。