包
包的树型结构显示![在这里插入图片描述](https://img-blog.csdnimg.cn/20190606140131593.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L01pa293b28wMDc=,size_16,color_FFFFFF,t_70)
快速导入包
Ctrl+Shift+O
封装
访问权限
属性
自动生成属性
This 关键字
this
指 当前正在使用对象的地址
public class User {
String name;
int age;
User(String name ,int age){
this.name = name;
this.age = age;
System.out.println(this);
}
void show() {
System.out.println("用户名是="+this.name);
}
public static void main(String[] args) {
User user1 = new User("zs",10);
user1.show();
User user2 = new User("李四",20);
user2.show();
}
}